// 蜂窝蜜造平台生成代码，如手工更改，请添加到 .beeignore 忽略生成

package com.fowo.api.service.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fowo.api.common.config.CacheConfig;
import com.fowo.api.common.excel.CustomExcelExport;
import com.fowo.api.common.excel.CustomExcelHandler;
import com.fowo.api.common.excel.ExcelConfig;
import com.fowo.api.common.excel.TemplateModelBuildEventListener;
import com.fowo.api.common.model.ImportRow;
import com.fowo.api.common.model.JoinModel;
import com.fowo.api.common.model.OptionItem;
import com.fowo.api.common.model.RException;
import com.fowo.api.common.util.DateUtils;
import com.fowo.api.common.util.ResponseUtils;
import com.fowo.api.common.util.SheetUtils;
import com.fowo.api.entity.OrderRule;
import com.fowo.api.flow.entity.WorkFlow;
import com.fowo.api.flow.service.WorkFlowService;
import com.fowo.api.mapper.ClassifyMapper;
import com.fowo.api.mapper.NavLogisticsChannelViewMapper;
import com.fowo.api.mapper.NavLogisticsProviderViewMapper;
import com.fowo.api.mapper.OrderRuleMapper;
import com.fowo.api.mapper.ProductMapper;
import com.fowo.api.mapper.ShopInfoMapper;
import com.fowo.api.mapper.SysCountryMapper;
import com.fowo.api.mapper.SysRegionMapper;
import com.fowo.api.mapper.WarehouseMapper;
import com.fowo.api.model.classify.ClassifyItemVo;
import com.fowo.api.model.classify.ClassifySearchParamPo;
import com.fowo.api.model.nav.logistics.channel.view.NavLogisticsChannelViewItemVo;
import com.fowo.api.model.nav.logistics.channel.view.NavLogisticsChannelViewSearchParamPo;
import com.fowo.api.model.nav.logistics.provider.view.NavLogisticsProviderViewItemVo;
import com.fowo.api.model.nav.logistics.provider.view.NavLogisticsProviderViewSearchParamPo;
import com.fowo.api.model.order.rule.OrderRuleDisableAction;
import com.fowo.api.model.order.rule.OrderRuleEnableAction;
import com.fowo.api.model.order.rule.OrderRuleExcelPo;
import com.fowo.api.model.order.rule.OrderRuleImportPo;
import com.fowo.api.model.order.rule.OrderRuleItemVo;
import com.fowo.api.model.order.rule.OrderRuleSearchParamPo;
import com.fowo.api.model.order.rule.OrderRuleVo;
import com.fowo.api.model.product.ProductItemVo;
import com.fowo.api.model.product.ProductSearchParamPo;
import com.fowo.api.model.shop.info.ShopInfoItemVo;
import com.fowo.api.model.shop.info.ShopInfoSearchParamPo;
import com.fowo.api.model.sys.country.SysCountryItemVo;
import com.fowo.api.model.sys.country.SysCountrySearchParamPo;
import com.fowo.api.model.sys.region.SysRegionItemVo;
import com.fowo.api.model.sys.region.SysRegionSearchParamPo;
import com.fowo.api.model.warehouse.WarehouseItemVo;
import com.fowo.api.model.warehouse.WarehouseSearchParamPo;
import com.fowo.api.service.OrderRuleService;
import com.fowo.api.sys.annotation.DataActivity;
import com.fowo.api.sys.component.SysDataActivityAopHelper;
import com.fowo.api.sys.entity.SysFile;
import com.fowo.api.sys.entity.SysImportTemplate;
import com.fowo.api.sys.entity.enums.SysDataActivityAction;
import com.fowo.api.sys.model.SysDictAllItem;
import com.fowo.api.sys.service.FileService;
import com.fowo.api.sys.service.SysDictService;
import com.fowo.api.sys.service.SysImportTemplateService;
import com.fowo.api.user.model.JwtUserInfo;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;

/**
 * 订单规则 服务实现基类
 * @author 蜂窝蜜造平台 配置人：任凯
 */
@Slf4j
@DS("ds24")
public class OrderRuleBaseServiceImpl
  extends ServiceImpl<OrderRuleMapper, OrderRule>
  implements OrderRuleService {

  /** 引用字段排序字段名转换信息 */
  public static final Map<String, String> SORT_FIELD_MAP = new HashMap<>() {
    {
      put("splitBaseOrderSiteName", "sr.`name`");
      put("splitBaseOrderShopInfoShopName", "si.`shop_name`");
      put("splitWarehouseLogisticsCountryCountry", "sc.`country`");
      put("splitOrderProductName", "p.`name`");
      put("splitOrderProductClassifyName", "c.`name`");
      put("splitOrderLogisticsLabel", "nlpv.`label`");
      put("joinBaseOrderSiteName", "sr2.`name`");
      put("joinBaseOrderShopInfoShopName", "si2.`shop_name`");
      put("joinOrderProductName", "p2.`name`");
      put("joinOrderProductClassifyName", "c2.`name`");
      put("joinOrderLogisticsLabel", "nlpv2.`label`");
      put("warehouseBaseOrderSiteName", "sr3.`name`");
      put("warehouseBaseOrderShopInfoShopName", "si3.`shop_name`");
      put("warehouseWarehouseLogisticsCountryCountry", "sc2.`country`");
      put("warehouseOrderProductName", "p3.`name`");
      put("warehouseOrderProductClassifyName", "c3.`name`");
      put("warehouseOrderLogisticsLabel", "nlpv3.`label`");
      put("warehouseActDeliveryWarehouseName", "w.`name`");
      put("warehouseActOptionWarehouseName", "w2.`name`");
      put("logisticsBaseOrderSiteName", "sr4.`name`");
      put("logisticsBaseOrderShopInfoShopName", "si4.`shop_name`");
      put("logisticsWarehouseLogisticsCountryCountry", "sc3.`country`");
      put("logisticsOrderProductName", "p4.`name`");
      put("logisticsOrderProductClassifyName", "c4.`name`");
      put("logisticsOrderLogisticsLabel", "nlpv4.`label`");
      put("logisticsActChannelLabel", "nlcv.`label`");
      put("logisticsActProviderLabel", "nlpv5.`label`");
      put("addressBaseOrderSiteName", "sr5.`name`");
      put("addressBaseOrderShopInfoShopName", "si5.`shop_name`");
      put("addressWarehouseLogisticsDeliveryWarehouseName", "w3.`name`");
      put("addressWarehouseLogisticsProviderLabel", "nlpv6.`label`");
      put("addressWarehouseLogisticsChannelLabel", "nlcv2.`label`");
      put("addressWarehouseLogisticsCountryCountry", "sc4.`country`");
      put("addressOrderProductName", "p5.`name`");
      put("addressOrderProductClassifyName", "c5.`name`");
      put("addressOrderLogisticsLabel", "nlpv7.`label`");
      put("processBaseOrderSiteName", "sr6.`name`");
      put("processBaseOrderShopInfoShopName", "si6.`shop_name`");
      put("processWarehouseLogisticsDeliveryWarehouseName", "w4.`name`");
      put("processWarehouseLogisticsProviderLabel", "nlpv8.`label`");
      put("processWarehouseLogisticsChannelLabel", "nlcv3.`label`");
      put("processWarehouseLogisticsCountryCountry", "sc5.`country`");
      put("processOrderProductName", "p6.`name`");
      put("processOrderProductClassifyName", "c6.`name`");
      put("processOrderLogisticsLabel", "nlpv9.`label`");
      put("issuBaseOrderSiteName", "sr7.`name`");
      put("issuBaseOrderShopInfoShopName", "si7.`shop_name`");
      put("issuWarehouseLogisticsDeliveryWarehouseName", "w5.`name`");
      put("issuWarehouseLogisticsProviderLabel", "nlpv10.`label`");
      put("issuWarehouseLogisticsChannelLabel", "nlcv4.`label`");
      put("issuOrderLogisticsLabel", "nlpv11.`label`");
    }
  };
  // 导出时单次查询最大记录数
  protected static final int EXPORT_QUERY_MAX_SIZE = 1000;
  // 支持导出的最大记录数(1048576 为 Excel 支持的最大行数)
  protected static final long EXPORT_MAX_SIZE = 1048575;

  /**
   * 服务自引用，用于调用服务方法时包括 AOP 处理
   */
  @Resource
  protected OrderRuleService self;

  @Resource
  private SysDictService sysDictService;

  @Resource
  protected SysRegionMapper sysRegionMapper;

  @Resource
  protected ShopInfoMapper shopInfoMapper;

  @Resource
  protected SysCountryMapper sysCountryMapper;

  @Resource
  protected ProductMapper productMapper;

  @Resource
  protected ClassifyMapper classifyMapper;

  @Resource
  protected NavLogisticsProviderViewMapper navLogisticsProviderViewMapper;

  @Resource
  protected WarehouseMapper warehouseMapper;

  @Resource
  protected NavLogisticsChannelViewMapper navLogisticsChannelViewMapper;

  @Resource
  protected FileService fileService;

  @Resource
  protected SysImportTemplateService importTemplateService;

  @Resource
  private CustomExcelExport customExcelExport;

  @Resource
  protected WorkFlowService workFlowService;

  @Autowired(required = false)
  protected OrderRuleEnableAction orderRuleEnableAction;

  @Autowired(required = false)
  protected OrderRuleDisableAction orderRuleDisableAction;

  @Resource
  protected Validator validator;

  /**
   * 创建订单规则
   * @param model 订单规则
   * @return 新数据的主键
   */
  @DataActivity(action = SysDataActivityAction.Add)
  @Transactional(rollbackFor = Exception.class)
  @Override
  public Long create(OrderRuleVo model) throws Exception {
    JwtUserInfo currentUser = JwtUserInfo.fromHeader();
    OrderRule entity = new OrderRule();
    BeanUtils.copyProperties(model, entity);
    entity.setCreateTime(new Date());
    entity.setLastUpdateTime(new Date());
    if (currentUser != null) {
      entity.setCreateUser(currentUser.getUserId());
      entity.setLastUpdateUser(currentUser.getUserId());
    }

    if (model.getStatus() == null) {
      entity.setStatus("1");
    }

    if (model.getSplitSplitMode() == null) {
      entity.setSplitSplitMode("1");
    }
    if (this.save(entity)) {
      return entity.getId();
    }
    throw new Exception("订单规则保存失败");
  }

  /**
   * 更新订单规则
   * @param model 订单规则
   * @return 更新是否成功
   */
  @DataActivity(action = SysDataActivityAction.Modified)
  @Override
  @Transactional(rollbackFor = Exception.class)
  public boolean update(OrderRuleVo model) throws Exception {
    JwtUserInfo currentUser = JwtUserInfo.fromHeader();
    OrderRule entity = this.getById(model.getId());
    if (entity == null) {
      throw new Exception("订单规则不存在");
    }
    BeanUtils.copyProperties(
      model,
      entity,
      "id",
      "addressWarehouseLogisticsDeliveryWarehouse",
      "issuBaseOrderShopInfo",
      "createUser",
      "createTime",
      "lastUpdateUser",
      "lastUpdateTime"
    );
    entity.setLastUpdateTime(new Date());
    if (currentUser != null) {
      entity.setLastUpdateUser(currentUser.getUserId());
    }
    if (this.updateById(entity)) {
      return true;
    }
    return false;
  }/**
   * 更新订单规则（带空值）
   * @param model 订单规则
   * @return 更新是否成功
   */

  @DataActivity(action = SysDataActivityAction.Modified)
  @Override
  @Transactional(rollbackFor = Exception.class)
  public boolean updateForEdit(OrderRuleVo model) throws Exception {
    JwtUserInfo currentUser = JwtUserInfo.fromHeader();
    OrderRule entity = this.getById(model.getId());
    if (entity == null) {
      throw new Exception("订单规则不存在");
    }
    model.setLastUpdateTime(new Date());
    if (currentUser != null) {
      model.setLastUpdateUser(currentUser.getUserId());
    }
    boolean isOk = new LambdaUpdateChainWrapper<>(baseMapper)
      .set(OrderRule::getName, model.getName())
      .set(OrderRule::getType, model.getType())
      .set(OrderRule::getStatus, model.getStatus())
      .set(OrderRule::getSplitSplitMode, model.getSplitSplitMode())
      .set(
        OrderRule::getSplitBaseOrderOriginal,
        model.getSplitBaseOrderOriginal()
      )
      .set(OrderRule::getSplitBaseOrderType, model.getSplitBaseOrderType())
      .set(
        OrderRule::getSplitBaseOrderPlatform,
        model.getSplitBaseOrderPlatform()
      )
      .set(OrderRule::getSplitBaseOrderSite, model.getSplitBaseOrderSite())
      .set(
        OrderRule::getSplitBaseOrderShopInfo,
        model.getSplitBaseOrderShopInfo()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsCountry,
        model.getSplitWarehouseLogisticsCountry()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsProvince,
        model.getSplitWarehouseLogisticsProvince()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsCity,
        model.getSplitWarehouseLogisticsCity()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsPostCodeStart,
        model.getSplitWarehouseLogisticsPostCodeStart()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsContains,
        model.getSplitWarehouseLogisticsContains()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsChooseOne,
        model.getSplitWarehouseLogisticsChooseOne()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsWhite,
        model.getSplitWarehouseLogisticsWhite()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsBlack,
        model.getSplitWarehouseLogisticsBlack()
      )
      .set(
        OrderRule::getSplitWarehouseLogisticsAddressType,
        model.getSplitWarehouseLogisticsAddressType()
      )
      .set(OrderRule::getSplitOrderProduct, model.getSplitOrderProduct())
      .set(
        OrderRule::getSplitOrderProductClassify,
        model.getSplitOrderProductClassify()
      )
      .set(OrderRule::getSplitOrderMode, model.getSplitOrderMode())
      .set(OrderRule::getSplitOrderTotal, model.getSplitOrderTotal())
      .set(OrderRule::getSplitOrderSkuTotal, model.getSplitOrderSkuTotal())
      .set(
        OrderRule::getSplitOrderThinkWeight,
        model.getSplitOrderThinkWeight()
      )
      .set(OrderRule::getSplitOrderThinkSize, model.getSplitOrderThinkSize())
      .set(
        OrderRule::getSplitOrderTotalAmount,
        model.getSplitOrderTotalAmount()
      )
      .set(
        OrderRule::getSplitOrderProductStatus,
        model.getSplitOrderProductStatus()
      )
      .set(OrderRule::getSplitOrderLogistics, model.getSplitOrderLogistics())
      .set(OrderRule::getSplitOrderEndTime, model.getSplitOrderEndTime())
      .set(OrderRule::getSplitOrderSpecial, model.getSplitOrderSpecial())
      .set(
        OrderRule::getSplitOrderGrossMargin,
        model.getSplitOrderGrossMargin()
      )
      .set(OrderRule::getSplitAct, model.getSplitAct())
      .set(OrderRule::getSplitActMode, model.getSplitActMode())
      .set(OrderRule::getJoinActSizeThreshold, model.getJoinActSizeThreshold())
      .set(
        OrderRule::getJoinActWeightThreshold,
        model.getJoinActWeightThreshold()
      )
      .set(OrderRule::getJoinBaseOrderType, model.getJoinBaseOrderType())
      .set(
        OrderRule::getJoinBaseOrderPlatform,
        model.getJoinBaseOrderPlatform()
      )
      .set(OrderRule::getJoinBaseOrderSite, model.getJoinBaseOrderSite())
      .set(
        OrderRule::getJoinBaseOrderShopInfo,
        model.getJoinBaseOrderShopInfo()
      )
      .set(
        OrderRule::getJoinWarehouseLogisticsAddressType,
        model.getJoinWarehouseLogisticsAddressType()
      )
      .set(OrderRule::getJoinOrderProduct, model.getJoinOrderProduct())
      .set(
        OrderRule::getJoinOrderProductClassify,
        model.getJoinOrderProductClassify()
      )
      .set(OrderRule::getJoinOrderTotalAmount, model.getJoinOrderTotalAmount())
      .set(OrderRule::getJoinOrderMode, model.getJoinOrderMode())
      .set(OrderRule::getJoinOrderTotal, model.getJoinOrderTotal())
      .set(OrderRule::getJoinOrderSkuTotal, model.getJoinOrderSkuTotal())
      .set(OrderRule::getJoinOrderThinkSize, model.getJoinOrderThinkSize())
      .set(OrderRule::getJoinOrderThinkWeight, model.getJoinOrderThinkWeight())
      .set(OrderRule::getJoinOrderLogistics, model.getJoinOrderLogistics())
      .set(OrderRule::getJoinOrderSpecial, model.getJoinOrderSpecial())
      .set(OrderRule::getJoinOrderGrossMargin, model.getJoinOrderGrossMargin())
      .set(OrderRule::getJoinActMode, model.getJoinActMode())
      .set(
        OrderRule::getWarehouseBaseOrderPlatform,
        model.getWarehouseBaseOrderPlatform()
      )
      .set(
        OrderRule::getWarehouseBaseOrderSite,
        model.getWarehouseBaseOrderSite()
      )
      .set(
        OrderRule::getWarehouseBaseOrderShopInfo,
        model.getWarehouseBaseOrderShopInfo()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsCountry,
        model.getWarehouseWarehouseLogisticsCountry()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsProvince,
        model.getWarehouseWarehouseLogisticsProvince()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsCity,
        model.getWarehouseWarehouseLogisticsCity()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsPostCodeStart,
        model.getWarehouseWarehouseLogisticsPostCodeStart()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsContains,
        model.getWarehouseWarehouseLogisticsContains()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsChooseOne,
        model.getWarehouseWarehouseLogisticsChooseOne()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsWhite,
        model.getWarehouseWarehouseLogisticsWhite()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsBlack,
        model.getWarehouseWarehouseLogisticsBlack()
      )
      .set(
        OrderRule::getWarehouseWarehouseLogisticsAddressType,
        model.getWarehouseWarehouseLogisticsAddressType()
      )
      .set(OrderRule::getWarehouseOrderMsku, model.getWarehouseOrderMsku())
      .set(
        OrderRule::getWarehouseOrderProduct,
        model.getWarehouseOrderProduct()
      )
      .set(
        OrderRule::getWarehouseOrderProductClassify,
        model.getWarehouseOrderProductClassify()
      )
      .set(
        OrderRule::getWarehouseOrderLogistics,
        model.getWarehouseOrderLogistics()
      )
      .set(
        OrderRule::getWarehouseOrderSpecial,
        model.getWarehouseOrderSpecial()
      )
      .set(
        OrderRule::getWarehouseOrderGrossMargin,
        model.getWarehouseOrderGrossMargin()
      )
      .set(
        OrderRule::getWarehouseActDeliveryWarehouse,
        model.getWarehouseActDeliveryWarehouse()
      )
      .set(
        OrderRule::getWarehouseActOptionWarehouse,
        model.getWarehouseActOptionWarehouse()
      )
      .set(
        OrderRule::getWarehouseActAutoCoverOriginal,
        model.getWarehouseActAutoCoverOriginal()
      )
      .set(
        OrderRule::getWarehouseActInventoryDeductionType,
        model.getWarehouseActInventoryDeductionType()
      )
      .set(
        OrderRule::getLogisticsBaseOrderPlatform,
        model.getLogisticsBaseOrderPlatform()
      )
      .set(
        OrderRule::getLogisticsBaseOrderSite,
        model.getLogisticsBaseOrderSite()
      )
      .set(
        OrderRule::getLogisticsBaseOrderShopInfo,
        model.getLogisticsBaseOrderShopInfo()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsCountry,
        model.getLogisticsWarehouseLogisticsCountry()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsProvince,
        model.getLogisticsWarehouseLogisticsProvince()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsCity,
        model.getLogisticsWarehouseLogisticsCity()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsPostCodeStart,
        model.getLogisticsWarehouseLogisticsPostCodeStart()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsContains,
        model.getLogisticsWarehouseLogisticsContains()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsChooseOne,
        model.getLogisticsWarehouseLogisticsChooseOne()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsWhite,
        model.getLogisticsWarehouseLogisticsWhite()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsBlack,
        model.getLogisticsWarehouseLogisticsBlack()
      )
      .set(
        OrderRule::getLogisticsWarehouseLogisticsAddressType,
        model.getLogisticsWarehouseLogisticsAddressType()
      )
      .set(OrderRule::getLogisticsOrderMsku, model.getLogisticsOrderMsku())
      .set(
        OrderRule::getLogisticsOrderProduct,
        model.getLogisticsOrderProduct()
      )
      .set(
        OrderRule::getLogisticsOrderProductClassify,
        model.getLogisticsOrderProductClassify()
      )
      .set(
        OrderRule::getLogisticsOrderThinkSize,
        model.getLogisticsOrderThinkSize()
      )
      .set(
        OrderRule::getLogisticsOrderThinkWeight,
        model.getLogisticsOrderThinkWeight()
      )
      .set(
        OrderRule::getLogisticsOrderTotalAmount,
        model.getLogisticsOrderTotalAmount()
      )
      .set(
        OrderRule::getLogisticsOrderLogistics,
        model.getLogisticsOrderLogistics()
      )
      .set(
        OrderRule::getLogisticsOrderFreight,
        model.getLogisticsOrderFreight()
      )
      .set(
        OrderRule::getLogisticsOrderSpecial,
        model.getLogisticsOrderSpecial()
      )
      .set(
        OrderRule::getLogisticsOrderGrossMargin,
        model.getLogisticsOrderGrossMargin()
      )
      .set(
        OrderRule::getLogisticsActSettingMethod,
        model.getLogisticsActSettingMethod()
      )
      .set(OrderRule::getLogisticsActChannel, model.getLogisticsActChannel())
      .set(
        OrderRule::getLogisticsActOverseasWarehouseAutoMapping,
        model.getLogisticsActOverseasWarehouseAutoMapping()
      )
      .set(
        OrderRule::getLogisticsActAutoCoverOriginal,
        model.getLogisticsActAutoCoverOriginal()
      )
      .set(
        OrderRule::getLogisticsActPriceParity,
        model.getLogisticsActPriceParity()
      )
      .set(OrderRule::getLogisticsActProvider, model.getLogisticsActProvider())
      .set(OrderRule::getAddressBaseSource, model.getAddressBaseSource())
      .set(
        OrderRule::getAddressBaseOrderPlatform,
        model.getAddressBaseOrderPlatform()
      )
      .set(OrderRule::getAddressBaseOrderSite, model.getAddressBaseOrderSite())
      .set(
        OrderRule::getAddressBaseOrderShopInfo,
        model.getAddressBaseOrderShopInfo()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsProvider,
        model.getAddressWarehouseLogisticsProvider()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsChannel,
        model.getAddressWarehouseLogisticsChannel()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsCountry,
        model.getAddressWarehouseLogisticsCountry()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsProvince,
        model.getAddressWarehouseLogisticsProvince()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsCity,
        model.getAddressWarehouseLogisticsCity()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsPostCodeStart,
        model.getAddressWarehouseLogisticsPostCodeStart()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsContains,
        model.getAddressWarehouseLogisticsContains()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsChooseOne,
        model.getAddressWarehouseLogisticsChooseOne()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsBlack,
        model.getAddressWarehouseLogisticsBlack()
      )
      .set(
        OrderRule::getAddressWarehouseLogisticsAddressType,
        model.getAddressWarehouseLogisticsAddressType()
      )
      .set(OrderRule::getAddressOrderProduct, model.getAddressOrderProduct())
      .set(
        OrderRule::getAddressOrderProductClassify,
        model.getAddressOrderProductClassify()
      )
      .set(OrderRule::getAddressOrderMode, model.getAddressOrderMode())
      .set(OrderRule::getAddressOrderTotal, model.getAddressOrderTotal())
      .set(OrderRule::getAddressOrderSkuTotal, model.getAddressOrderSkuTotal())
      .set(
        OrderRule::getAddressOrderThinkWeight,
        model.getAddressOrderThinkWeight()
      )
      .set(
        OrderRule::getAddressOrderThinkSize,
        model.getAddressOrderThinkSize()
      )
      .set(
        OrderRule::getAddressOrderTotalAmount,
        model.getAddressOrderTotalAmount()
      )
      .set(OrderRule::getAddressOrderStatus, model.getAddressOrderStatus())
      .set(
        OrderRule::getAddressOrderLogistics,
        model.getAddressOrderLogistics()
      )
      .set(OrderRule::getAddressOrderEndTime, model.getAddressOrderEndTime())
      .set(OrderRule::getAddressOrderSpecial, model.getAddressOrderSpecial())
      .set(
        OrderRule::getAddressOrderGrossMargin,
        model.getAddressOrderGrossMargin()
      )
      .set(OrderRule::getAddressActFill, model.getAddressActFill())
      .set(OrderRule::getAddressActSelectQJ, model.getAddressActSelectQJ())
      .set(
        OrderRule::getAddressActHouseNoAnalysis1,
        model.getAddressActHouseNoAnalysis1()
      )
      .set(
        OrderRule::getAddressActHouseNoAnalysis2,
        model.getAddressActHouseNoAnalysis2()
      )
      .set(
        OrderRule::getAddressActHouseNoAnalysis3,
        model.getAddressActHouseNoAnalysis3()
      )
      .set(
        OrderRule::getAddressActPhoneSimplify1,
        model.getAddressActPhoneSimplify1()
      )
      .set(
        OrderRule::getAddressActPhoneSimplify2,
        model.getAddressActPhoneSimplify2()
      )
      .set(
        OrderRule::getAddressActPhoneSimplify3,
        model.getAddressActPhoneSimplify3()
      )
      .set(
        OrderRule::getAddressActPhoneSimplify4,
        model.getAddressActPhoneSimplify4()
      )
      .set(
        OrderRule::getAddressActPostHandle1,
        model.getAddressActPostHandle1()
      )
      .set(
        OrderRule::getAddressActPostHandle2,
        model.getAddressActPostHandle2()
      )
      .set(OrderRule::getProcessBaseSource, model.getProcessBaseSource())
      .set(
        OrderRule::getProcessBaseOrderPlatform,
        model.getProcessBaseOrderPlatform()
      )
      .set(OrderRule::getProcessBaseOrderSite, model.getProcessBaseOrderSite())
      .set(
        OrderRule::getProcessBaseOrderShopInfo,
        model.getProcessBaseOrderShopInfo()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsDeliveryWarehouse,
        model.getProcessWarehouseLogisticsDeliveryWarehouse()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsProvider,
        model.getProcessWarehouseLogisticsProvider()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsChannel,
        model.getProcessWarehouseLogisticsChannel()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsCountry,
        model.getProcessWarehouseLogisticsCountry()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsProvince,
        model.getProcessWarehouseLogisticsProvince()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsCity,
        model.getProcessWarehouseLogisticsCity()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsPostCodeStart,
        model.getProcessWarehouseLogisticsPostCodeStart()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsContains,
        model.getProcessWarehouseLogisticsContains()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsChooseOne,
        model.getProcessWarehouseLogisticsChooseOne()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsBlack,
        model.getProcessWarehouseLogisticsBlack()
      )
      .set(
        OrderRule::getProcessWarehouseLogisticsprocessType,
        model.getProcessWarehouseLogisticsprocessType()
      )
      .set(OrderRule::getProcessOrderProduct, model.getProcessOrderProduct())
      .set(
        OrderRule::getProcessOrderProductClassify,
        model.getProcessOrderProductClassify()
      )
      .set(OrderRule::getProcessOrderMode, model.getProcessOrderMode())
      .set(OrderRule::getProcessOrderTotal, model.getProcessOrderTotal())
      .set(OrderRule::getProcessOrderSkuTotal, model.getProcessOrderSkuTotal())
      .set(
        OrderRule::getProcessOrderThinkWeight,
        model.getProcessOrderThinkWeight()
      )
      .set(
        OrderRule::getProcessOrderThinkSize,
        model.getProcessOrderThinkSize()
      )
      .set(
        OrderRule::getProcessOrderTotalAmount,
        model.getProcessOrderTotalAmount()
      )
      .set(OrderRule::getProcessOrderStatus, model.getProcessOrderStatus())
      .set(
        OrderRule::getProcessOrderLogistics,
        model.getProcessOrderLogistics()
      )
      .set(OrderRule::getProcessOrderEndTime, model.getProcessOrderEndTime())
      .set(OrderRule::getProcessOrderSpecial, model.getProcessOrderSpecial())
      .set(
        OrderRule::getProcessOrderGrossMargin,
        model.getProcessOrderGrossMargin()
      )
      .set(OrderRule::getProcessAct, model.getProcessAct())
      .set(
        OrderRule::getIssuBaseOrderPlatform,
        model.getIssuBaseOrderPlatform()
      )
      .set(OrderRule::getIssuBaseOrderSite, model.getIssuBaseOrderSite())
      .set(
        OrderRule::getIssuWarehouseLogisticsDeliveryWarehouse,
        model.getIssuWarehouseLogisticsDeliveryWarehouse()
      )
      .set(
        OrderRule::getIssuWarehouseLogisticsProvider,
        model.getIssuWarehouseLogisticsProvider()
      )
      .set(
        OrderRule::getIssuWarehouseLogisticsChannel,
        model.getIssuWarehouseLogisticsChannel()
      )
      .set(OrderRule::getIssuOrderLogistics, model.getIssuOrderLogistics())
      .set(OrderRule::getIssuOrderGrossMargin, model.getIssuOrderGrossMargin())
      .set(OrderRule::getIssuActRules, model.getIssuActRules())
      .set(OrderRule::getLastUpdateUser, model.getLastUpdateUser())
      .set(OrderRule::getLastUpdateTime, model.getLastUpdateTime())
      .eq(OrderRule::getId, model.getId())
      .update();
    if (isOk) {}
    return isOk;
  }

  /**
   * 是否走导出中心
   */
  @Override
  public boolean getBackgroundExportFlag(OrderRuleSearchParamPo search) {
    return false;
  }

  /**
   * 删除订单规则
   * @param id 订单规则的主键
   * @return 删除是否成功
   */
  @DataActivity(action = SysDataActivityAction.Del)
  @Override
  public boolean delete(Long id) throws Exception {
    return this.removeById(id);
  }

  /**
   * 批量删除订单规则
   * @param ids 订单规则的主键列表
   * @return 删除是否成功
   */
  @DataActivity(action = SysDataActivityAction.Del)
  @Override
  public boolean batchDelete(List<Long> ids) throws Exception {
    return baseMapper.deleteBatchIds(ids) > 0;
  }

  /**
   * 导入单行处理
   * @param row 要导入的行
   * @param rowNumber 所在行号
   * @param vo 输出VO,可空
   * @param variables 变量池，用于在一次导入过程中保存临时信息
   * @param allowOverrides 允许覆盖
   * @return 导入行对象
   */
  protected ImportRow<OrderRuleImportPo> excelToImportRow(
    OrderRuleImportPo row,
    Integer rowNumber,
    OrderRuleVo vo,
    Map<String, Object> variables,
    boolean allowOverrides
  ) {
    ImportRow<OrderRuleImportPo> ir = new ImportRow<OrderRuleImportPo>();
    ir.setRowNumber(rowNumber);
    ir.setRow(row);
    if (SheetUtils.isAllFieldsEmpty(row)) {
      ir.setEmptyRow(true);
      ir.addError("", "空行");
      return ir;
    }
    final Set<ConstraintViolation<OrderRuleImportPo>> validate =
      validator.validate(row);
    boolean isOutputVo = vo != null;
    if (!isOutputVo) {
      vo = new OrderRuleVo();
    }
    BeanUtils.copyProperties(row, vo);
    // 收集基本校验错误
    ir.initErrors(validate, OrderRuleImportPo.class);

    // 一般数据处理
    if (StringUtils.hasText(row.getType())) {
      List<SysDictAllItem> typeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "type",
          n -> sysDictService.getDictItems("SCM10117")
        );
      OrderRuleVo finalVo = vo;
      typeItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getType()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setType(i.getItemValue()),
          () ->
            ir.addError(
              "type",
              String.format(
                "必须为 %s 中之一",
                typeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getStatus())) {
      List<SysDictAllItem> statusItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "status",
          n -> sysDictService.getDictItems("SCM00134")
        );
      OrderRuleVo finalVo = vo;
      statusItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getStatus()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setStatus(i.getItemValue()),
          () ->
            ir.addError(
              "status",
              String.format(
                "必须为 %s 中之一",
                statusItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getSplitSplitMode())) {
      List<SysDictAllItem> splitSplitModeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitSplitMode",
          n -> sysDictService.getDictItems("SCM00118")
        );
      OrderRuleVo finalVo = vo;
      splitSplitModeItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getSplitSplitMode()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setSplitSplitMode(i.getItemValue()),
          () ->
            ir.addError(
              "splitSplitMode",
              String.format(
                "必须为 %s 中之一",
                splitSplitModeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getSplitBaseOrderOriginal())) {
      List<SysDictAllItem> splitBaseOrderOriginalItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitBaseOrderOriginal",
          n -> sysDictService.getDictItems("SCM00121")
        );
      OrderRuleVo finalVo = vo;
      List<String> splitBaseOrderOriginalTexts = Arrays
        .stream(row.getSplitBaseOrderOriginal().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setSplitBaseOrderOriginal(
        splitBaseOrderOriginalItems
          .stream()
          .filter(i -> splitBaseOrderOriginalTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getSplitBaseOrderType())) {
      List<SysDictAllItem> splitBaseOrderTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitBaseOrderType",
          n -> sysDictService.getDictItems("SCM00122")
        );
      OrderRuleVo finalVo = vo;
      List<String> splitBaseOrderTypeTexts = Arrays
        .stream(row.getSplitBaseOrderType().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setSplitBaseOrderType(
        splitBaseOrderTypeItems
          .stream()
          .filter(i -> splitBaseOrderTypeTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getSplitBaseOrderPlatform())) {
      List<SysDictAllItem> splitBaseOrderPlatformItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitBaseOrderPlatform",
          n -> sysDictService.getDictItems("SCM00106")
        );
      OrderRuleVo finalVo = vo;
      List<String> splitBaseOrderPlatformTexts = Arrays
        .stream(row.getSplitBaseOrderPlatform().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setSplitBaseOrderPlatform(
        splitBaseOrderPlatformItems
          .stream()
          .filter(i -> splitBaseOrderPlatformTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getSplitWarehouseLogisticsChooseOne())) {
      List<SysDictAllItem> splitWarehouseLogisticsChooseOneItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitWarehouseLogisticsChooseOne",
          n -> sysDictService.getDictItems("SCM00008")
        );
      OrderRuleVo finalVo = vo;
      splitWarehouseLogisticsChooseOneItems
        .stream()
        .filter(i ->
          i.getItemText().equals(row.getSplitWarehouseLogisticsChooseOne())
        )
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setSplitWarehouseLogisticsChooseOne(i.getItemValue()),
          () ->
            ir.addError(
              "splitWarehouseLogisticsChooseOne",
              String.format(
                "必须为 %s 中之一",
                splitWarehouseLogisticsChooseOneItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getSplitWarehouseLogisticsAddressType())) {
      List<SysDictAllItem> splitWarehouseLogisticsAddressTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitWarehouseLogisticsAddressType",
          n -> sysDictService.getDictItems("SCM00124")
        );
      OrderRuleVo finalVo = vo;
      List<String> splitWarehouseLogisticsAddressTypeTexts = Arrays
        .stream(row.getSplitWarehouseLogisticsAddressType().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setSplitWarehouseLogisticsAddressType(
        splitWarehouseLogisticsAddressTypeItems
          .stream()
          .filter(i ->
            splitWarehouseLogisticsAddressTypeTexts.contains(i.getItemText())
          )
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getSplitOrderMode())) {
      List<SysDictAllItem> splitOrderModeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitOrderMode",
          n -> sysDictService.getDictItems("SCM00129")
        );
      OrderRuleVo finalVo = vo;
      splitOrderModeItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getSplitOrderMode()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setSplitOrderMode(i.getItemValue()),
          () ->
            ir.addError(
              "splitOrderMode",
              String.format(
                "必须为 %s 中之一",
                splitOrderModeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getSplitOrderProductStatus())) {
      List<SysDictAllItem> splitOrderProductStatusItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitOrderProductStatus",
          n -> sysDictService.getDictItems("SCM00006")
        );
      OrderRuleVo finalVo = vo;
      List<String> splitOrderProductStatusTexts = Arrays
        .stream(row.getSplitOrderProductStatus().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setSplitOrderProductStatus(
        splitOrderProductStatusItems
          .stream()
          .filter(i -> splitOrderProductStatusTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getSplitOrderSpecial())) {
      List<SysDictAllItem> splitOrderSpecialItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitOrderSpecial",
          n -> sysDictService.getDictItems("SCM00009")
        );
      OrderRuleVo finalVo = vo;
      List<String> splitOrderSpecialTexts = Arrays
        .stream(row.getSplitOrderSpecial().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setSplitOrderSpecial(
        splitOrderSpecialItems
          .stream()
          .filter(i -> splitOrderSpecialTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getSplitAct())) {
      List<SysDictAllItem> splitActItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitAct",
          n -> sysDictService.getDictItems("SCM00128")
        );
      OrderRuleVo finalVo = vo;
      splitActItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getSplitAct()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setSplitAct(i.getItemValue()),
          () ->
            ir.addError(
              "splitAct",
              String.format(
                "必须为 %s 中之一",
                splitActItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getSplitActMode())) {
      List<SysDictAllItem> splitActModeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "splitActMode",
          n -> sysDictService.getDictItems("SCM00126")
        );
      OrderRuleVo finalVo = vo;
      splitActModeItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getSplitActMode()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setSplitActMode(i.getItemValue()),
          () ->
            ir.addError(
              "splitActMode",
              String.format(
                "必须为 %s 中之一",
                splitActModeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getJoinBaseOrderType())) {
      List<SysDictAllItem> joinBaseOrderTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "joinBaseOrderType",
          n -> sysDictService.getDictItems("SCM00122")
        );
      OrderRuleVo finalVo = vo;
      List<String> joinBaseOrderTypeTexts = Arrays
        .stream(row.getJoinBaseOrderType().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setJoinBaseOrderType(
        joinBaseOrderTypeItems
          .stream()
          .filter(i -> joinBaseOrderTypeTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getJoinBaseOrderPlatform())) {
      List<SysDictAllItem> joinBaseOrderPlatformItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "joinBaseOrderPlatform",
          n -> sysDictService.getDictItems("SCM00106")
        );
      OrderRuleVo finalVo = vo;
      List<String> joinBaseOrderPlatformTexts = Arrays
        .stream(row.getJoinBaseOrderPlatform().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setJoinBaseOrderPlatform(
        joinBaseOrderPlatformItems
          .stream()
          .filter(i -> joinBaseOrderPlatformTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getJoinWarehouseLogisticsAddressType())) {
      List<SysDictAllItem> joinWarehouseLogisticsAddressTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "joinWarehouseLogisticsAddressType",
          n -> sysDictService.getDictItems("SCM00124")
        );
      OrderRuleVo finalVo = vo;
      List<String> joinWarehouseLogisticsAddressTypeTexts = Arrays
        .stream(row.getJoinWarehouseLogisticsAddressType().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setJoinWarehouseLogisticsAddressType(
        joinWarehouseLogisticsAddressTypeItems
          .stream()
          .filter(i ->
            joinWarehouseLogisticsAddressTypeTexts.contains(i.getItemText())
          )
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getJoinOrderMode())) {
      List<SysDictAllItem> joinOrderModeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "joinOrderMode",
          n -> sysDictService.getDictItems("SCM00129")
        );
      OrderRuleVo finalVo = vo;
      joinOrderModeItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getJoinOrderMode()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setJoinOrderMode(i.getItemValue()),
          () ->
            ir.addError(
              "joinOrderMode",
              String.format(
                "必须为 %s 中之一",
                joinOrderModeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getJoinOrderSpecial())) {
      List<SysDictAllItem> joinOrderSpecialItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "joinOrderSpecial",
          n -> sysDictService.getDictItems("SCM00009")
        );
      OrderRuleVo finalVo = vo;
      joinOrderSpecialItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getJoinOrderSpecial()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setJoinOrderSpecial(i.getItemValue()),
          () ->
            ir.addError(
              "joinOrderSpecial",
              String.format(
                "必须为 %s 中之一",
                joinOrderSpecialItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getJoinActMode())) {
      List<SysDictAllItem> joinActModeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "joinActMode",
          n -> sysDictService.getDictItems("SCM00125")
        );
      OrderRuleVo finalVo = vo;
      joinActModeItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getJoinActMode()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setJoinActMode(i.getItemValue()),
          () ->
            ir.addError(
              "joinActMode",
              String.format(
                "必须为 %s 中之一",
                joinActModeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getWarehouseBaseOrderPlatform())) {
      List<SysDictAllItem> warehouseBaseOrderPlatformItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "warehouseBaseOrderPlatform",
          n -> sysDictService.getDictItems("SCM00106")
        );
      OrderRuleVo finalVo = vo;
      List<String> warehouseBaseOrderPlatformTexts = Arrays
        .stream(row.getWarehouseBaseOrderPlatform().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setWarehouseBaseOrderPlatform(
        warehouseBaseOrderPlatformItems
          .stream()
          .filter(i -> warehouseBaseOrderPlatformTexts.contains(i.getItemText())
          )
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getWarehouseWarehouseLogisticsChooseOne())) {
      List<SysDictAllItem> warehouseWarehouseLogisticsChooseOneItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "warehouseWarehouseLogisticsChooseOne",
          n -> sysDictService.getDictItems("SCM00008")
        );
      OrderRuleVo finalVo = vo;
      warehouseWarehouseLogisticsChooseOneItems
        .stream()
        .filter(i ->
          i.getItemText().equals(row.getWarehouseWarehouseLogisticsChooseOne())
        )
        .findFirst()
        .ifPresentOrElse(
          i ->
            finalVo.setWarehouseWarehouseLogisticsChooseOne(i.getItemValue()),
          () ->
            ir.addError(
              "warehouseWarehouseLogisticsChooseOne",
              String.format(
                "必须为 %s 中之一",
                warehouseWarehouseLogisticsChooseOneItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getWarehouseWarehouseLogisticsAddressType())) {
      List<SysDictAllItem> warehouseWarehouseLogisticsAddressTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "warehouseWarehouseLogisticsAddressType",
          n -> sysDictService.getDictItems("SCM00124")
        );
      OrderRuleVo finalVo = vo;
      List<String> warehouseWarehouseLogisticsAddressTypeTexts = Arrays
        .stream(row.getWarehouseWarehouseLogisticsAddressType().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setWarehouseWarehouseLogisticsAddressType(
        warehouseWarehouseLogisticsAddressTypeItems
          .stream()
          .filter(i ->
            warehouseWarehouseLogisticsAddressTypeTexts.contains(
              i.getItemText()
            )
          )
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getWarehouseOrderSpecial())) {
      List<SysDictAllItem> warehouseOrderSpecialItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "warehouseOrderSpecial",
          n -> sysDictService.getDictItems("SCM00009")
        );
      OrderRuleVo finalVo = vo;
      List<String> warehouseOrderSpecialTexts = Arrays
        .stream(row.getWarehouseOrderSpecial().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setWarehouseOrderSpecial(
        warehouseOrderSpecialItems
          .stream()
          .filter(i -> warehouseOrderSpecialTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getWarehouseActAutoCoverOriginal())) {
      List<SysDictAllItem> warehouseActAutoCoverOriginalItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "warehouseActAutoCoverOriginal",
          n -> sysDictService.getDictItems("SCM00008")
        );
      OrderRuleVo finalVo = vo;
      warehouseActAutoCoverOriginalItems
        .stream()
        .filter(i ->
          i.getItemText().equals(row.getWarehouseActAutoCoverOriginal())
        )
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setWarehouseActAutoCoverOriginal(i.getItemValue()),
          () ->
            ir.addError(
              "warehouseActAutoCoverOriginal",
              String.format(
                "必须为 %s 中之一",
                warehouseActAutoCoverOriginalItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getWarehouseActInventoryDeductionType())) {
      List<SysDictAllItem> warehouseActInventoryDeductionTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "warehouseActInventoryDeductionType",
          n -> sysDictService.getDictItems("SCM00127")
        );
      OrderRuleVo finalVo = vo;
      warehouseActInventoryDeductionTypeItems
        .stream()
        .filter(i ->
          i.getItemText().equals(row.getWarehouseActInventoryDeductionType())
        )
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setWarehouseActInventoryDeductionType(i.getItemValue()),
          () ->
            ir.addError(
              "warehouseActInventoryDeductionType",
              String.format(
                "必须为 %s 中之一",
                warehouseActInventoryDeductionTypeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getLogisticsBaseOrderPlatform())) {
      List<SysDictAllItem> logisticsBaseOrderPlatformItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "logisticsBaseOrderPlatform",
          n -> sysDictService.getDictItems("SCM00106")
        );
      OrderRuleVo finalVo = vo;
      List<String> logisticsBaseOrderPlatformTexts = Arrays
        .stream(row.getLogisticsBaseOrderPlatform().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setLogisticsBaseOrderPlatform(
        logisticsBaseOrderPlatformItems
          .stream()
          .filter(i -> logisticsBaseOrderPlatformTexts.contains(i.getItemText())
          )
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getLogisticsWarehouseLogisticsChooseOne())) {
      List<SysDictAllItem> logisticsWarehouseLogisticsChooseOneItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "logisticsWarehouseLogisticsChooseOne",
          n -> sysDictService.getDictItems("SCM00008")
        );
      OrderRuleVo finalVo = vo;
      logisticsWarehouseLogisticsChooseOneItems
        .stream()
        .filter(i ->
          i.getItemText().equals(row.getLogisticsWarehouseLogisticsChooseOne())
        )
        .findFirst()
        .ifPresentOrElse(
          i ->
            finalVo.setLogisticsWarehouseLogisticsChooseOne(i.getItemValue()),
          () ->
            ir.addError(
              "logisticsWarehouseLogisticsChooseOne",
              String.format(
                "必须为 %s 中之一",
                logisticsWarehouseLogisticsChooseOneItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getLogisticsWarehouseLogisticsAddressType())) {
      List<SysDictAllItem> logisticsWarehouseLogisticsAddressTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "logisticsWarehouseLogisticsAddressType",
          n -> sysDictService.getDictItems("SCM00124")
        );
      OrderRuleVo finalVo = vo;
      List<String> logisticsWarehouseLogisticsAddressTypeTexts = Arrays
        .stream(row.getLogisticsWarehouseLogisticsAddressType().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setLogisticsWarehouseLogisticsAddressType(
        logisticsWarehouseLogisticsAddressTypeItems
          .stream()
          .filter(i ->
            logisticsWarehouseLogisticsAddressTypeTexts.contains(
              i.getItemText()
            )
          )
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getLogisticsOrderSpecial())) {
      List<SysDictAllItem> logisticsOrderSpecialItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "logisticsOrderSpecial",
          n -> sysDictService.getDictItems("SCM00009")
        );
      OrderRuleVo finalVo = vo;
      List<String> logisticsOrderSpecialTexts = Arrays
        .stream(row.getLogisticsOrderSpecial().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setLogisticsOrderSpecial(
        logisticsOrderSpecialItems
          .stream()
          .filter(i -> logisticsOrderSpecialTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getLogisticsActSettingMethod())) {
      List<SysDictAllItem> logisticsActSettingMethodItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "logisticsActSettingMethod",
          n -> sysDictService.getDictItems("SCM00119")
        );
      OrderRuleVo finalVo = vo;
      logisticsActSettingMethodItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getLogisticsActSettingMethod()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setLogisticsActSettingMethod(i.getItemValue()),
          () ->
            ir.addError(
              "logisticsActSettingMethod",
              String.format(
                "必须为 %s 中之一",
                logisticsActSettingMethodItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (
      StringUtils.hasText(row.getLogisticsActOverseasWarehouseAutoMapping())
    ) {
      List<SysDictAllItem> logisticsActOverseasWarehouseAutoMappingItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "logisticsActOverseasWarehouseAutoMapping",
          n -> sysDictService.getDictItems("SCM00008")
        );
      OrderRuleVo finalVo = vo;
      logisticsActOverseasWarehouseAutoMappingItems
        .stream()
        .filter(i ->
          i
            .getItemText()
            .equals(row.getLogisticsActOverseasWarehouseAutoMapping())
        )
        .findFirst()
        .ifPresentOrElse(
          i ->
            finalVo.setLogisticsActOverseasWarehouseAutoMapping(
              i.getItemValue()
            ),
          () ->
            ir.addError(
              "logisticsActOverseasWarehouseAutoMapping",
              String.format(
                "必须为 %s 中之一",
                logisticsActOverseasWarehouseAutoMappingItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getLogisticsActAutoCoverOriginal())) {
      List<SysDictAllItem> logisticsActAutoCoverOriginalItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "logisticsActAutoCoverOriginal",
          n -> sysDictService.getDictItems("SCM00008")
        );
      OrderRuleVo finalVo = vo;
      logisticsActAutoCoverOriginalItems
        .stream()
        .filter(i ->
          i.getItemText().equals(row.getLogisticsActAutoCoverOriginal())
        )
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setLogisticsActAutoCoverOriginal(i.getItemValue()),
          () ->
            ir.addError(
              "logisticsActAutoCoverOriginal",
              String.format(
                "必须为 %s 中之一",
                logisticsActAutoCoverOriginalItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getLogisticsActPriceParity())) {
      List<SysDictAllItem> logisticsActPriceParityItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "logisticsActPriceParity",
          n -> sysDictService.getDictItems("SCM00120")
        );
      OrderRuleVo finalVo = vo;
      List<String> logisticsActPriceParityTexts = Arrays
        .stream(row.getLogisticsActPriceParity().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setLogisticsActPriceParity(
        logisticsActPriceParityItems
          .stream()
          .filter(i -> logisticsActPriceParityTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getAddressBaseSource())) {
      List<SysDictAllItem> addressBaseSourceItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressBaseSource",
          n -> sysDictService.getDictItems("SCM00121")
        );
      OrderRuleVo finalVo = vo;
      List<String> addressBaseSourceTexts = Arrays
        .stream(row.getAddressBaseSource().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setAddressBaseSource(
        addressBaseSourceItems
          .stream()
          .filter(i -> addressBaseSourceTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getAddressBaseOrderPlatform())) {
      List<SysDictAllItem> addressBaseOrderPlatformItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressBaseOrderPlatform",
          n -> sysDictService.getDictItems("SCM00106")
        );
      OrderRuleVo finalVo = vo;
      List<String> addressBaseOrderPlatformTexts = Arrays
        .stream(row.getAddressBaseOrderPlatform().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setAddressBaseOrderPlatform(
        addressBaseOrderPlatformItems
          .stream()
          .filter(i -> addressBaseOrderPlatformTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getAddressWarehouseLogisticsChooseOne())) {
      List<SysDictAllItem> addressWarehouseLogisticsChooseOneItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressWarehouseLogisticsChooseOne",
          n -> sysDictService.getDictItems("SCM00008")
        );
      OrderRuleVo finalVo = vo;
      addressWarehouseLogisticsChooseOneItems
        .stream()
        .filter(i ->
          i.getItemText().equals(row.getAddressWarehouseLogisticsChooseOne())
        )
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setAddressWarehouseLogisticsChooseOne(i.getItemValue()),
          () ->
            ir.addError(
              "addressWarehouseLogisticsChooseOne",
              String.format(
                "必须为 %s 中之一",
                addressWarehouseLogisticsChooseOneItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getAddressWarehouseLogisticsAddressType())) {
      List<SysDictAllItem> addressWarehouseLogisticsAddressTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressWarehouseLogisticsAddressType",
          n -> sysDictService.getDictItems("SCM00124")
        );
      OrderRuleVo finalVo = vo;
      List<String> addressWarehouseLogisticsAddressTypeTexts = Arrays
        .stream(row.getAddressWarehouseLogisticsAddressType().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setAddressWarehouseLogisticsAddressType(
        addressWarehouseLogisticsAddressTypeItems
          .stream()
          .filter(i ->
            addressWarehouseLogisticsAddressTypeTexts.contains(i.getItemText())
          )
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getAddressOrderMode())) {
      List<SysDictAllItem> addressOrderModeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressOrderMode",
          n -> sysDictService.getDictItems("SCM00129")
        );
      OrderRuleVo finalVo = vo;
      addressOrderModeItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getAddressOrderMode()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setAddressOrderMode(i.getItemValue()),
          () ->
            ir.addError(
              "addressOrderMode",
              String.format(
                "必须为 %s 中之一",
                addressOrderModeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getAddressOrderStatus())) {
      List<SysDictAllItem> addressOrderStatusItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressOrderStatus",
          n -> sysDictService.getDictItems("SCM00006")
        );
      OrderRuleVo finalVo = vo;
      List<String> addressOrderStatusTexts = Arrays
        .stream(row.getAddressOrderStatus().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setAddressOrderStatus(
        addressOrderStatusItems
          .stream()
          .filter(i -> addressOrderStatusTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    vo.setAddressOrderEndTime(
      SheetUtils.tryToDate(row.getAddressOrderEndTime())
    );
    SheetUtils.datePreviewFormat(
      row.getAddressOrderEndTime(),
      row::setAddressOrderEndTime
    );
    if (StringUtils.hasText(row.getAddressOrderSpecial())) {
      List<SysDictAllItem> addressOrderSpecialItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressOrderSpecial",
          n -> sysDictService.getDictItems("SCM00009")
        );
      OrderRuleVo finalVo = vo;
      List<String> addressOrderSpecialTexts = Arrays
        .stream(row.getAddressOrderSpecial().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setAddressOrderSpecial(
        addressOrderSpecialItems
          .stream()
          .filter(i -> addressOrderSpecialTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getAddressActFill())) {
      List<SysDictAllItem> addressActFillItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressActFill",
          n -> sysDictService.getDictItems("SCM00130")
        );
      OrderRuleVo finalVo = vo;
      List<String> addressActFillTexts = Arrays
        .stream(row.getAddressActFill().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setAddressActFill(
        addressActFillItems
          .stream()
          .filter(i -> addressActFillTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getAddressActSelectQJ())) {
      List<SysDictAllItem> addressActSelectQJItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "addressActSelectQJ",
          n -> sysDictService.getDictItems("SCM00131")
        );
      OrderRuleVo finalVo = vo;
      List<String> addressActSelectQJTexts = Arrays
        .stream(row.getAddressActSelectQJ().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setAddressActSelectQJ(
        addressActSelectQJItems
          .stream()
          .filter(i -> addressActSelectQJTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getProcessBaseSource())) {
      List<SysDictAllItem> processBaseSourceItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "processBaseSource",
          n -> sysDictService.getDictItems("SCM00121")
        );
      OrderRuleVo finalVo = vo;
      List<String> processBaseSourceTexts = Arrays
        .stream(row.getProcessBaseSource().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setProcessBaseSource(
        processBaseSourceItems
          .stream()
          .filter(i -> processBaseSourceTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getProcessBaseOrderPlatform())) {
      List<SysDictAllItem> processBaseOrderPlatformItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "processBaseOrderPlatform",
          n -> sysDictService.getDictItems("SCM00106")
        );
      OrderRuleVo finalVo = vo;
      List<String> processBaseOrderPlatformTexts = Arrays
        .stream(row.getProcessBaseOrderPlatform().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setProcessBaseOrderPlatform(
        processBaseOrderPlatformItems
          .stream()
          .filter(i -> processBaseOrderPlatformTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getProcessWarehouseLogisticsChooseOne())) {
      List<SysDictAllItem> processWarehouseLogisticsChooseOneItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "processWarehouseLogisticsChooseOne",
          n -> sysDictService.getDictItems("SCM00008")
        );
      OrderRuleVo finalVo = vo;
      processWarehouseLogisticsChooseOneItems
        .stream()
        .filter(i ->
          i.getItemText().equals(row.getProcessWarehouseLogisticsChooseOne())
        )
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setProcessWarehouseLogisticsChooseOne(i.getItemValue()),
          () ->
            ir.addError(
              "processWarehouseLogisticsChooseOne",
              String.format(
                "必须为 %s 中之一",
                processWarehouseLogisticsChooseOneItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getProcessWarehouseLogisticsprocessType())) {
      List<SysDictAllItem> processWarehouseLogisticsprocessTypeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "processWarehouseLogisticsprocessType",
          n -> sysDictService.getDictItems("SCM00124")
        );
      OrderRuleVo finalVo = vo;
      List<String> processWarehouseLogisticsprocessTypeTexts = Arrays
        .stream(row.getProcessWarehouseLogisticsprocessType().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setProcessWarehouseLogisticsprocessType(
        processWarehouseLogisticsprocessTypeItems
          .stream()
          .filter(i ->
            processWarehouseLogisticsprocessTypeTexts.contains(i.getItemText())
          )
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getProcessOrderMode())) {
      List<SysDictAllItem> processOrderModeItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "processOrderMode",
          n -> sysDictService.getDictItems("SCM00129")
        );
      OrderRuleVo finalVo = vo;
      processOrderModeItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getProcessOrderMode()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setProcessOrderMode(i.getItemValue()),
          () ->
            ir.addError(
              "processOrderMode",
              String.format(
                "必须为 %s 中之一",
                processOrderModeItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getProcessOrderStatus())) {
      List<SysDictAllItem> processOrderStatusItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "processOrderStatus",
          n -> sysDictService.getDictItems("SCM00006")
        );
      OrderRuleVo finalVo = vo;
      List<String> processOrderStatusTexts = Arrays
        .stream(row.getProcessOrderStatus().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setProcessOrderStatus(
        processOrderStatusItems
          .stream()
          .filter(i -> processOrderStatusTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getProcessOrderSpecial())) {
      List<SysDictAllItem> processOrderSpecialItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "processOrderSpecial",
          n -> sysDictService.getDictItems("SCM00009")
        );
      OrderRuleVo finalVo = vo;
      List<String> processOrderSpecialTexts = Arrays
        .stream(row.getProcessOrderSpecial().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setProcessOrderSpecial(
        processOrderSpecialItems
          .stream()
          .filter(i -> processOrderSpecialTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getProcessAct())) {
      List<SysDictAllItem> processActItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "processAct",
          n -> sysDictService.getDictItems("SCM00132")
        );
      OrderRuleVo finalVo = vo;
      processActItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getProcessAct()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setProcessAct(i.getItemValue()),
          () ->
            ir.addError(
              "processAct",
              String.format(
                "必须为 %s 中之一",
                processActItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    if (StringUtils.hasText(row.getIssuBaseOrderPlatform())) {
      List<SysDictAllItem> issuBaseOrderPlatformItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "issuBaseOrderPlatform",
          n -> sysDictService.getDictItems("SCM00106")
        );
      OrderRuleVo finalVo = vo;
      List<String> issuBaseOrderPlatformTexts = Arrays
        .stream(row.getIssuBaseOrderPlatform().split(","))
        .filter(StringUtils::hasText)
        .collect(Collectors.toList());
      finalVo.setIssuBaseOrderPlatform(
        issuBaseOrderPlatformItems
          .stream()
          .filter(i -> issuBaseOrderPlatformTexts.contains(i.getItemText()))
          .map(SysDictAllItem::getItemValue)
          .collect(Collectors.joining(","))
      );
    }
    if (StringUtils.hasText(row.getIssuActRules())) {
      List<SysDictAllItem> issuActRulesItems =
        (List<SysDictAllItem>) variables.computeIfAbsent(
          "issuActRules",
          n -> sysDictService.getDictItems("SCM00133")
        );
      OrderRuleVo finalVo = vo;
      issuActRulesItems
        .stream()
        .filter(i -> i.getItemText().equals(row.getIssuActRules()))
        .findFirst()
        .ifPresentOrElse(
          i -> finalVo.setIssuActRules(i.getItemValue()),
          () ->
            ir.addError(
              "issuActRules",
              String.format(
                "必须为 %s 中之一",
                issuActRulesItems
                  .stream()
                  .map(SysDictAllItem::getItemText)
                  .collect(Collectors.joining(", "))
              )
            )
        );
    }
    // 处理关联字段“订单站点”
    if (
      !SheetUtils.isBlank(row.getSplitBaseOrderSiteName()) &&
      SheetUtils.isBlank(row.getSplitBaseOrderSite())
    ) {
      SysRegionSearchParamPo splitBaseOrderSiteSearchParam =
        new SysRegionSearchParamPo();
      splitBaseOrderSiteSearchParam.setLimit(2); // 最大只返回二行记录
      splitBaseOrderSiteSearchParam.setNameEq(
        SheetUtils.trim(row.getSplitBaseOrderSiteName())
      );
      splitBaseOrderSiteSearchParam.applySqlSegments();
      List<SysRegionItemVo> splitBaseOrderSiteMatches = sysRegionMapper.search(
        splitBaseOrderSiteSearchParam
      );
      if (splitBaseOrderSiteMatches.size() == 0) {
        ir.addError("splitBaseOrderSiteName", "未能在站点中找到匹配的数据");
      } else if (splitBaseOrderSiteMatches.size() > 1) {
        ir.addError(
          "splitBaseOrderSiteName",
          "关联不唯一，在站点中找到多个匹配的数据"
        );
      } else {
        vo.setSplitBaseOrderSite(
          splitBaseOrderSiteMatches
            .stream()
            .map(SysRegionItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单店铺”
    if (
      !SheetUtils.isBlank(row.getSplitBaseOrderShopInfoShopName()) &&
      SheetUtils.isBlank(row.getSplitBaseOrderShopInfo())
    ) {
      ShopInfoSearchParamPo splitBaseOrderShopInfoSearchParam =
        new ShopInfoSearchParamPo();
      splitBaseOrderShopInfoSearchParam.setLimit(2); // 最大只返回二行记录
      splitBaseOrderShopInfoSearchParam.setShopNameEq(
        SheetUtils.trim(row.getSplitBaseOrderShopInfoShopName())
      );
      splitBaseOrderShopInfoSearchParam.applySqlSegments();
      List<ShopInfoItemVo> splitBaseOrderShopInfoMatches =
        shopInfoMapper.search(splitBaseOrderShopInfoSearchParam);
      if (splitBaseOrderShopInfoMatches.size() == 0) {
        ir.addError(
          "splitBaseOrderShopInfoShopName",
          "未能在店铺中找到匹配的数据"
        );
      } else if (splitBaseOrderShopInfoMatches.size() > 1) {
        ir.addError(
          "splitBaseOrderShopInfoShopName",
          "关联不唯一，在店铺中找到多个匹配的数据"
        );
      } else {
        vo.setSplitBaseOrderShopInfo(
          splitBaseOrderShopInfoMatches
            .stream()
            .map(ShopInfoItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“收货国家/地区”
    if (
      !SheetUtils.isBlank(row.getSplitWarehouseLogisticsCountryCountry()) &&
      SheetUtils.isBlank(row.getSplitWarehouseLogisticsCountry())
    ) {
      SysCountrySearchParamPo splitWarehouseLogisticsCountrySearchParam =
        new SysCountrySearchParamPo();
      splitWarehouseLogisticsCountrySearchParam.setLimit(2); // 最大只返回二行记录
      splitWarehouseLogisticsCountrySearchParam.setCountryEq(
        SheetUtils.trim(row.getSplitWarehouseLogisticsCountryCountry())
      );
      splitWarehouseLogisticsCountrySearchParam.applySqlSegments();
      List<SysCountryItemVo> splitWarehouseLogisticsCountryMatches =
        sysCountryMapper.search(splitWarehouseLogisticsCountrySearchParam);
      if (splitWarehouseLogisticsCountryMatches.size() == 0) {
        ir.addError(
          "splitWarehouseLogisticsCountryCountry",
          "未能在国家中找到匹配的数据"
        );
      } else if (splitWarehouseLogisticsCountryMatches.size() > 1) {
        ir.addError(
          "splitWarehouseLogisticsCountryCountry",
          "关联不唯一，在国家中找到多个匹配的数据"
        );
      } else {
        vo.setSplitWarehouseLogisticsCountry(
          splitWarehouseLogisticsCountryMatches
            .stream()
            .map(SysCountryItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单产品”
    if (
      !SheetUtils.isBlank(row.getSplitOrderProductName()) &&
      SheetUtils.isBlank(row.getSplitOrderProduct())
    ) {
      ProductSearchParamPo splitOrderProductSearchParam =
        new ProductSearchParamPo();
      splitOrderProductSearchParam.setLimit(2); // 最大只返回二行记录
      splitOrderProductSearchParam.setNameEq(
        SheetUtils.trim(row.getSplitOrderProductName())
      );
      splitOrderProductSearchParam.applySqlSegments();
      List<ProductItemVo> splitOrderProductMatches = productMapper.search(
        splitOrderProductSearchParam
      );
      if (splitOrderProductMatches.size() == 0) {
        ir.addError("splitOrderProductName", "未能在产品管理中找到匹配的数据");
      } else if (splitOrderProductMatches.size() > 1) {
        ir.addError(
          "splitOrderProductName",
          "关联不唯一，在产品管理中找到多个匹配的数据"
        );
      } else {
        vo.setSplitOrderProduct(
          splitOrderProductMatches
            .stream()
            .map(ProductItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“产品分类”
    if (
      !SheetUtils.isBlank(row.getSplitOrderProductClassifyName()) &&
      SheetUtils.isBlank(row.getSplitOrderProductClassify())
    ) {
      ClassifySearchParamPo splitOrderProductClassifySearchParam =
        new ClassifySearchParamPo();
      splitOrderProductClassifySearchParam.setLimit(2); // 最大只返回二行记录
      splitOrderProductClassifySearchParam.setNameEq(
        SheetUtils.trim(row.getSplitOrderProductClassifyName())
      );
      splitOrderProductClassifySearchParam.applySqlSegments();
      List<ClassifyItemVo> splitOrderProductClassifyMatches =
        classifyMapper.search(splitOrderProductClassifySearchParam);
      if (splitOrderProductClassifyMatches.size() == 0) {
        ir.addError(
          "splitOrderProductClassifyName",
          "未能在分类管理中找到匹配的数据"
        );
      } else if (splitOrderProductClassifyMatches.size() > 1) {
        ir.addError(
          "splitOrderProductClassifyName",
          "关联不唯一，在分类管理中找到多个匹配的数据"
        );
      } else {
        vo.setSplitOrderProductClassify(
          splitOrderProductClassifyMatches
            .stream()
            .map(ClassifyItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“客选物流”
    if (
      !SheetUtils.isBlank(row.getSplitOrderLogisticsLabel()) &&
      SheetUtils.isBlank(row.getSplitOrderLogistics())
    ) {
      NavLogisticsProviderViewSearchParamPo splitOrderLogisticsSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      splitOrderLogisticsSearchParam.setLimit(2); // 最大只返回二行记录
      splitOrderLogisticsSearchParam.setLabelEq(
        SheetUtils.trim(row.getSplitOrderLogisticsLabel())
      );
      splitOrderLogisticsSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> splitOrderLogisticsMatches =
        navLogisticsProviderViewMapper.search(splitOrderLogisticsSearchParam);
      if (splitOrderLogisticsMatches.size() == 0) {
        ir.addError(
          "splitOrderLogisticsLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (splitOrderLogisticsMatches.size() > 1) {
        ir.addError(
          "splitOrderLogisticsLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setSplitOrderLogistics(
          splitOrderLogisticsMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单站点”
    if (
      !SheetUtils.isBlank(row.getJoinBaseOrderSiteName()) &&
      SheetUtils.isBlank(row.getJoinBaseOrderSite())
    ) {
      SysRegionSearchParamPo joinBaseOrderSiteSearchParam =
        new SysRegionSearchParamPo();
      joinBaseOrderSiteSearchParam.setLimit(2); // 最大只返回二行记录
      joinBaseOrderSiteSearchParam.setNameEq(
        SheetUtils.trim(row.getJoinBaseOrderSiteName())
      );
      joinBaseOrderSiteSearchParam.applySqlSegments();
      List<SysRegionItemVo> joinBaseOrderSiteMatches = sysRegionMapper.search(
        joinBaseOrderSiteSearchParam
      );
      if (joinBaseOrderSiteMatches.size() == 0) {
        ir.addError("joinBaseOrderSiteName", "未能在站点中找到匹配的数据");
      } else if (joinBaseOrderSiteMatches.size() > 1) {
        ir.addError(
          "joinBaseOrderSiteName",
          "关联不唯一，在站点中找到多个匹配的数据"
        );
      } else {
        vo.setJoinBaseOrderSite(
          joinBaseOrderSiteMatches
            .stream()
            .map(SysRegionItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单店铺”
    if (
      !SheetUtils.isBlank(row.getJoinBaseOrderShopInfoShopName()) &&
      SheetUtils.isBlank(row.getJoinBaseOrderShopInfo())
    ) {
      ShopInfoSearchParamPo joinBaseOrderShopInfoSearchParam =
        new ShopInfoSearchParamPo();
      joinBaseOrderShopInfoSearchParam.setLimit(2); // 最大只返回二行记录
      joinBaseOrderShopInfoSearchParam.setShopNameEq(
        SheetUtils.trim(row.getJoinBaseOrderShopInfoShopName())
      );
      joinBaseOrderShopInfoSearchParam.applySqlSegments();
      List<ShopInfoItemVo> joinBaseOrderShopInfoMatches = shopInfoMapper.search(
        joinBaseOrderShopInfoSearchParam
      );
      if (joinBaseOrderShopInfoMatches.size() == 0) {
        ir.addError(
          "joinBaseOrderShopInfoShopName",
          "未能在店铺中找到匹配的数据"
        );
      } else if (joinBaseOrderShopInfoMatches.size() > 1) {
        ir.addError(
          "joinBaseOrderShopInfoShopName",
          "关联不唯一，在店铺中找到多个匹配的数据"
        );
      } else {
        vo.setJoinBaseOrderShopInfo(
          joinBaseOrderShopInfoMatches
            .stream()
            .map(ShopInfoItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单产品”
    if (
      !SheetUtils.isBlank(row.getJoinOrderProductName()) &&
      SheetUtils.isBlank(row.getJoinOrderProduct())
    ) {
      ProductSearchParamPo joinOrderProductSearchParam =
        new ProductSearchParamPo();
      joinOrderProductSearchParam.setLimit(2); // 最大只返回二行记录
      joinOrderProductSearchParam.setNameEq(
        SheetUtils.trim(row.getJoinOrderProductName())
      );
      joinOrderProductSearchParam.applySqlSegments();
      List<ProductItemVo> joinOrderProductMatches = productMapper.search(
        joinOrderProductSearchParam
      );
      if (joinOrderProductMatches.size() == 0) {
        ir.addError("joinOrderProductName", "未能在产品管理中找到匹配的数据");
      } else if (joinOrderProductMatches.size() > 1) {
        ir.addError(
          "joinOrderProductName",
          "关联不唯一，在产品管理中找到多个匹配的数据"
        );
      } else {
        vo.setJoinOrderProduct(
          joinOrderProductMatches
            .stream()
            .map(ProductItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“产品分类”
    if (
      !SheetUtils.isBlank(row.getJoinOrderProductClassifyName()) &&
      SheetUtils.isBlank(row.getJoinOrderProductClassify())
    ) {
      ClassifySearchParamPo joinOrderProductClassifySearchParam =
        new ClassifySearchParamPo();
      joinOrderProductClassifySearchParam.setLimit(2); // 最大只返回二行记录
      joinOrderProductClassifySearchParam.setNameEq(
        SheetUtils.trim(row.getJoinOrderProductClassifyName())
      );
      joinOrderProductClassifySearchParam.applySqlSegments();
      List<ClassifyItemVo> joinOrderProductClassifyMatches =
        classifyMapper.search(joinOrderProductClassifySearchParam);
      if (joinOrderProductClassifyMatches.size() == 0) {
        ir.addError(
          "joinOrderProductClassifyName",
          "未能在分类管理中找到匹配的数据"
        );
      } else if (joinOrderProductClassifyMatches.size() > 1) {
        ir.addError(
          "joinOrderProductClassifyName",
          "关联不唯一，在分类管理中找到多个匹配的数据"
        );
      } else {
        vo.setJoinOrderProductClassify(
          joinOrderProductClassifyMatches
            .stream()
            .map(ClassifyItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“客选物流”
    if (
      !SheetUtils.isBlank(row.getJoinOrderLogisticsLabel()) &&
      SheetUtils.isBlank(row.getJoinOrderLogistics())
    ) {
      NavLogisticsProviderViewSearchParamPo joinOrderLogisticsSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      joinOrderLogisticsSearchParam.setLimit(2); // 最大只返回二行记录
      joinOrderLogisticsSearchParam.setLabelEq(
        SheetUtils.trim(row.getJoinOrderLogisticsLabel())
      );
      joinOrderLogisticsSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> joinOrderLogisticsMatches =
        navLogisticsProviderViewMapper.search(joinOrderLogisticsSearchParam);
      if (joinOrderLogisticsMatches.size() == 0) {
        ir.addError(
          "joinOrderLogisticsLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (joinOrderLogisticsMatches.size() > 1) {
        ir.addError(
          "joinOrderLogisticsLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setJoinOrderLogistics(
          joinOrderLogisticsMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单站点”
    if (
      !SheetUtils.isBlank(row.getWarehouseBaseOrderSiteName()) &&
      SheetUtils.isBlank(row.getWarehouseBaseOrderSite())
    ) {
      SysRegionSearchParamPo warehouseBaseOrderSiteSearchParam =
        new SysRegionSearchParamPo();
      warehouseBaseOrderSiteSearchParam.setLimit(2); // 最大只返回二行记录
      warehouseBaseOrderSiteSearchParam.setNameEq(
        SheetUtils.trim(row.getWarehouseBaseOrderSiteName())
      );
      warehouseBaseOrderSiteSearchParam.applySqlSegments();
      List<SysRegionItemVo> warehouseBaseOrderSiteMatches =
        sysRegionMapper.search(warehouseBaseOrderSiteSearchParam);
      if (warehouseBaseOrderSiteMatches.size() == 0) {
        ir.addError("warehouseBaseOrderSiteName", "未能在站点中找到匹配的数据");
      } else if (warehouseBaseOrderSiteMatches.size() > 1) {
        ir.addError(
          "warehouseBaseOrderSiteName",
          "关联不唯一，在站点中找到多个匹配的数据"
        );
      } else {
        vo.setWarehouseBaseOrderSite(
          warehouseBaseOrderSiteMatches
            .stream()
            .map(SysRegionItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单店铺”
    if (
      !SheetUtils.isBlank(row.getWarehouseBaseOrderShopInfoShopName()) &&
      SheetUtils.isBlank(row.getWarehouseBaseOrderShopInfo())
    ) {
      ShopInfoSearchParamPo warehouseBaseOrderShopInfoSearchParam =
        new ShopInfoSearchParamPo();
      warehouseBaseOrderShopInfoSearchParam.setLimit(2); // 最大只返回二行记录
      warehouseBaseOrderShopInfoSearchParam.setShopNameEq(
        SheetUtils.trim(row.getWarehouseBaseOrderShopInfoShopName())
      );
      warehouseBaseOrderShopInfoSearchParam.applySqlSegments();
      List<ShopInfoItemVo> warehouseBaseOrderShopInfoMatches =
        shopInfoMapper.search(warehouseBaseOrderShopInfoSearchParam);
      if (warehouseBaseOrderShopInfoMatches.size() == 0) {
        ir.addError(
          "warehouseBaseOrderShopInfoShopName",
          "未能在店铺中找到匹配的数据"
        );
      } else if (warehouseBaseOrderShopInfoMatches.size() > 1) {
        ir.addError(
          "warehouseBaseOrderShopInfoShopName",
          "关联不唯一，在店铺中找到多个匹配的数据"
        );
      } else {
        vo.setWarehouseBaseOrderShopInfo(
          warehouseBaseOrderShopInfoMatches
            .stream()
            .map(ShopInfoItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“收货国家/地区”
    if (
      !SheetUtils.isBlank(row.getWarehouseWarehouseLogisticsCountryCountry()) &&
      SheetUtils.isBlank(row.getWarehouseWarehouseLogisticsCountry())
    ) {
      SysCountrySearchParamPo warehouseWarehouseLogisticsCountrySearchParam =
        new SysCountrySearchParamPo();
      warehouseWarehouseLogisticsCountrySearchParam.setLimit(2); // 最大只返回二行记录
      warehouseWarehouseLogisticsCountrySearchParam.setCountryEq(
        SheetUtils.trim(row.getWarehouseWarehouseLogisticsCountryCountry())
      );
      warehouseWarehouseLogisticsCountrySearchParam.applySqlSegments();
      List<SysCountryItemVo> warehouseWarehouseLogisticsCountryMatches =
        sysCountryMapper.search(warehouseWarehouseLogisticsCountrySearchParam);
      if (warehouseWarehouseLogisticsCountryMatches.size() == 0) {
        ir.addError(
          "warehouseWarehouseLogisticsCountryCountry",
          "未能在国家中找到匹配的数据"
        );
      } else if (warehouseWarehouseLogisticsCountryMatches.size() > 1) {
        ir.addError(
          "warehouseWarehouseLogisticsCountryCountry",
          "关联不唯一，在国家中找到多个匹配的数据"
        );
      } else {
        vo.setWarehouseWarehouseLogisticsCountry(
          warehouseWarehouseLogisticsCountryMatches
            .stream()
            .map(SysCountryItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单产品”
    if (
      !SheetUtils.isBlank(row.getWarehouseOrderProductName()) &&
      SheetUtils.isBlank(row.getWarehouseOrderProduct())
    ) {
      ProductSearchParamPo warehouseOrderProductSearchParam =
        new ProductSearchParamPo();
      warehouseOrderProductSearchParam.setLimit(2); // 最大只返回二行记录
      warehouseOrderProductSearchParam.setNameEq(
        SheetUtils.trim(row.getWarehouseOrderProductName())
      );
      warehouseOrderProductSearchParam.applySqlSegments();
      List<ProductItemVo> warehouseOrderProductMatches = productMapper.search(
        warehouseOrderProductSearchParam
      );
      if (warehouseOrderProductMatches.size() == 0) {
        ir.addError(
          "warehouseOrderProductName",
          "未能在产品管理中找到匹配的数据"
        );
      } else if (warehouseOrderProductMatches.size() > 1) {
        ir.addError(
          "warehouseOrderProductName",
          "关联不唯一，在产品管理中找到多个匹配的数据"
        );
      } else {
        vo.setWarehouseOrderProduct(
          warehouseOrderProductMatches
            .stream()
            .map(ProductItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“产品分类”
    if (
      !SheetUtils.isBlank(row.getWarehouseOrderProductClassifyName()) &&
      SheetUtils.isBlank(row.getWarehouseOrderProductClassify())
    ) {
      ClassifySearchParamPo warehouseOrderProductClassifySearchParam =
        new ClassifySearchParamPo();
      warehouseOrderProductClassifySearchParam.setLimit(2); // 最大只返回二行记录
      warehouseOrderProductClassifySearchParam.setNameEq(
        SheetUtils.trim(row.getWarehouseOrderProductClassifyName())
      );
      warehouseOrderProductClassifySearchParam.applySqlSegments();
      List<ClassifyItemVo> warehouseOrderProductClassifyMatches =
        classifyMapper.search(warehouseOrderProductClassifySearchParam);
      if (warehouseOrderProductClassifyMatches.size() == 0) {
        ir.addError(
          "warehouseOrderProductClassifyName",
          "未能在分类管理中找到匹配的数据"
        );
      } else if (warehouseOrderProductClassifyMatches.size() > 1) {
        ir.addError(
          "warehouseOrderProductClassifyName",
          "关联不唯一，在分类管理中找到多个匹配的数据"
        );
      } else {
        vo.setWarehouseOrderProductClassify(
          warehouseOrderProductClassifyMatches
            .stream()
            .map(ClassifyItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“客选物流”
    if (
      !SheetUtils.isBlank(row.getWarehouseOrderLogisticsLabel()) &&
      SheetUtils.isBlank(row.getWarehouseOrderLogistics())
    ) {
      NavLogisticsProviderViewSearchParamPo warehouseOrderLogisticsSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      warehouseOrderLogisticsSearchParam.setLimit(2); // 最大只返回二行记录
      warehouseOrderLogisticsSearchParam.setLabelEq(
        SheetUtils.trim(row.getWarehouseOrderLogisticsLabel())
      );
      warehouseOrderLogisticsSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> warehouseOrderLogisticsMatches =
        navLogisticsProviderViewMapper.search(
          warehouseOrderLogisticsSearchParam
        );
      if (warehouseOrderLogisticsMatches.size() == 0) {
        ir.addError(
          "warehouseOrderLogisticsLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (warehouseOrderLogisticsMatches.size() > 1) {
        ir.addError(
          "warehouseOrderLogisticsLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setWarehouseOrderLogistics(
          warehouseOrderLogisticsMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“发货仓库”
    if (
      !SheetUtils.isBlank(row.getWarehouseActDeliveryWarehouseName()) &&
      SheetUtils.isBlank(row.getWarehouseActDeliveryWarehouse())
    ) {
      WarehouseSearchParamPo warehouseActDeliveryWarehouseSearchParam =
        new WarehouseSearchParamPo();
      warehouseActDeliveryWarehouseSearchParam.setLimit(2); // 最大只返回二行记录
      warehouseActDeliveryWarehouseSearchParam.setNameEq(
        SheetUtils.trim(row.getWarehouseActDeliveryWarehouseName())
      );
      warehouseActDeliveryWarehouseSearchParam.applySqlSegments();
      List<WarehouseItemVo> warehouseActDeliveryWarehouseMatches =
        warehouseMapper.search(warehouseActDeliveryWarehouseSearchParam);
      if (warehouseActDeliveryWarehouseMatches.size() == 0) {
        ir.addError(
          "warehouseActDeliveryWarehouseName",
          "未能在仓库列表中找到匹配的数据"
        );
      } else if (warehouseActDeliveryWarehouseMatches.size() > 1) {
        ir.addError(
          "warehouseActDeliveryWarehouseName",
          "关联不唯一，在仓库列表中找到多个匹配的数据"
        );
      } else {
        vo.setWarehouseActDeliveryWarehouse(
          warehouseActDeliveryWarehouseMatches.get(0).getId()
        );
      }
    }
    // 处理关联字段“备选仓库”
    if (
      !SheetUtils.isBlank(row.getWarehouseActOptionWarehouseName()) &&
      SheetUtils.isBlank(row.getWarehouseActOptionWarehouse())
    ) {
      WarehouseSearchParamPo warehouseActOptionWarehouseSearchParam =
        new WarehouseSearchParamPo();
      warehouseActOptionWarehouseSearchParam.setLimit(2); // 最大只返回二行记录
      warehouseActOptionWarehouseSearchParam.setNameEq(
        SheetUtils.trim(row.getWarehouseActOptionWarehouseName())
      );
      warehouseActOptionWarehouseSearchParam.applySqlSegments();
      List<WarehouseItemVo> warehouseActOptionWarehouseMatches =
        warehouseMapper.search(warehouseActOptionWarehouseSearchParam);
      if (warehouseActOptionWarehouseMatches.size() == 0) {
        ir.addError(
          "warehouseActOptionWarehouseName",
          "未能在仓库列表中找到匹配的数据"
        );
      } else if (warehouseActOptionWarehouseMatches.size() > 1) {
        ir.addError(
          "warehouseActOptionWarehouseName",
          "关联不唯一，在仓库列表中找到多个匹配的数据"
        );
      } else {
        vo.setWarehouseActOptionWarehouse(
          warehouseActOptionWarehouseMatches
            .stream()
            .map(WarehouseItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单站点”
    if (
      !SheetUtils.isBlank(row.getLogisticsBaseOrderSiteName()) &&
      SheetUtils.isBlank(row.getLogisticsBaseOrderSite())
    ) {
      SysRegionSearchParamPo logisticsBaseOrderSiteSearchParam =
        new SysRegionSearchParamPo();
      logisticsBaseOrderSiteSearchParam.setLimit(2); // 最大只返回二行记录
      logisticsBaseOrderSiteSearchParam.setNameEq(
        SheetUtils.trim(row.getLogisticsBaseOrderSiteName())
      );
      logisticsBaseOrderSiteSearchParam.applySqlSegments();
      List<SysRegionItemVo> logisticsBaseOrderSiteMatches =
        sysRegionMapper.search(logisticsBaseOrderSiteSearchParam);
      if (logisticsBaseOrderSiteMatches.size() == 0) {
        ir.addError("logisticsBaseOrderSiteName", "未能在站点中找到匹配的数据");
      } else if (logisticsBaseOrderSiteMatches.size() > 1) {
        ir.addError(
          "logisticsBaseOrderSiteName",
          "关联不唯一，在站点中找到多个匹配的数据"
        );
      } else {
        vo.setLogisticsBaseOrderSite(
          logisticsBaseOrderSiteMatches
            .stream()
            .map(SysRegionItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单店铺”
    if (
      !SheetUtils.isBlank(row.getLogisticsBaseOrderShopInfoShopName()) &&
      SheetUtils.isBlank(row.getLogisticsBaseOrderShopInfo())
    ) {
      ShopInfoSearchParamPo logisticsBaseOrderShopInfoSearchParam =
        new ShopInfoSearchParamPo();
      logisticsBaseOrderShopInfoSearchParam.setLimit(2); // 最大只返回二行记录
      logisticsBaseOrderShopInfoSearchParam.setShopNameEq(
        SheetUtils.trim(row.getLogisticsBaseOrderShopInfoShopName())
      );
      logisticsBaseOrderShopInfoSearchParam.applySqlSegments();
      List<ShopInfoItemVo> logisticsBaseOrderShopInfoMatches =
        shopInfoMapper.search(logisticsBaseOrderShopInfoSearchParam);
      if (logisticsBaseOrderShopInfoMatches.size() == 0) {
        ir.addError(
          "logisticsBaseOrderShopInfoShopName",
          "未能在店铺中找到匹配的数据"
        );
      } else if (logisticsBaseOrderShopInfoMatches.size() > 1) {
        ir.addError(
          "logisticsBaseOrderShopInfoShopName",
          "关联不唯一，在店铺中找到多个匹配的数据"
        );
      } else {
        vo.setLogisticsBaseOrderShopInfo(
          logisticsBaseOrderShopInfoMatches
            .stream()
            .map(ShopInfoItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“收货国家/地区”
    if (
      !SheetUtils.isBlank(row.getLogisticsWarehouseLogisticsCountryCountry()) &&
      SheetUtils.isBlank(row.getLogisticsWarehouseLogisticsCountry())
    ) {
      SysCountrySearchParamPo logisticsWarehouseLogisticsCountrySearchParam =
        new SysCountrySearchParamPo();
      logisticsWarehouseLogisticsCountrySearchParam.setLimit(2); // 最大只返回二行记录
      logisticsWarehouseLogisticsCountrySearchParam.setCountryEq(
        SheetUtils.trim(row.getLogisticsWarehouseLogisticsCountryCountry())
      );
      logisticsWarehouseLogisticsCountrySearchParam.applySqlSegments();
      List<SysCountryItemVo> logisticsWarehouseLogisticsCountryMatches =
        sysCountryMapper.search(logisticsWarehouseLogisticsCountrySearchParam);
      if (logisticsWarehouseLogisticsCountryMatches.size() == 0) {
        ir.addError(
          "logisticsWarehouseLogisticsCountryCountry",
          "未能在国家中找到匹配的数据"
        );
      } else if (logisticsWarehouseLogisticsCountryMatches.size() > 1) {
        ir.addError(
          "logisticsWarehouseLogisticsCountryCountry",
          "关联不唯一，在国家中找到多个匹配的数据"
        );
      } else {
        vo.setLogisticsWarehouseLogisticsCountry(
          logisticsWarehouseLogisticsCountryMatches
            .stream()
            .map(SysCountryItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单产品”
    if (
      !SheetUtils.isBlank(row.getLogisticsOrderProductName()) &&
      SheetUtils.isBlank(row.getLogisticsOrderProduct())
    ) {
      ProductSearchParamPo logisticsOrderProductSearchParam =
        new ProductSearchParamPo();
      logisticsOrderProductSearchParam.setLimit(2); // 最大只返回二行记录
      logisticsOrderProductSearchParam.setNameEq(
        SheetUtils.trim(row.getLogisticsOrderProductName())
      );
      logisticsOrderProductSearchParam.applySqlSegments();
      List<ProductItemVo> logisticsOrderProductMatches = productMapper.search(
        logisticsOrderProductSearchParam
      );
      if (logisticsOrderProductMatches.size() == 0) {
        ir.addError(
          "logisticsOrderProductName",
          "未能在产品管理中找到匹配的数据"
        );
      } else if (logisticsOrderProductMatches.size() > 1) {
        ir.addError(
          "logisticsOrderProductName",
          "关联不唯一，在产品管理中找到多个匹配的数据"
        );
      } else {
        vo.setLogisticsOrderProduct(
          logisticsOrderProductMatches
            .stream()
            .map(ProductItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“产品分类”
    if (
      !SheetUtils.isBlank(row.getLogisticsOrderProductClassifyName()) &&
      SheetUtils.isBlank(row.getLogisticsOrderProductClassify())
    ) {
      ClassifySearchParamPo logisticsOrderProductClassifySearchParam =
        new ClassifySearchParamPo();
      logisticsOrderProductClassifySearchParam.setLimit(2); // 最大只返回二行记录
      logisticsOrderProductClassifySearchParam.setNameEq(
        SheetUtils.trim(row.getLogisticsOrderProductClassifyName())
      );
      logisticsOrderProductClassifySearchParam.applySqlSegments();
      List<ClassifyItemVo> logisticsOrderProductClassifyMatches =
        classifyMapper.search(logisticsOrderProductClassifySearchParam);
      if (logisticsOrderProductClassifyMatches.size() == 0) {
        ir.addError(
          "logisticsOrderProductClassifyName",
          "未能在分类管理中找到匹配的数据"
        );
      } else if (logisticsOrderProductClassifyMatches.size() > 1) {
        ir.addError(
          "logisticsOrderProductClassifyName",
          "关联不唯一，在分类管理中找到多个匹配的数据"
        );
      } else {
        vo.setLogisticsOrderProductClassify(
          logisticsOrderProductClassifyMatches
            .stream()
            .map(ClassifyItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“客选物流”
    if (
      !SheetUtils.isBlank(row.getLogisticsOrderLogisticsLabel()) &&
      SheetUtils.isBlank(row.getLogisticsOrderLogistics())
    ) {
      NavLogisticsProviderViewSearchParamPo logisticsOrderLogisticsSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      logisticsOrderLogisticsSearchParam.setLimit(2); // 最大只返回二行记录
      logisticsOrderLogisticsSearchParam.setLabelEq(
        SheetUtils.trim(row.getLogisticsOrderLogisticsLabel())
      );
      logisticsOrderLogisticsSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> logisticsOrderLogisticsMatches =
        navLogisticsProviderViewMapper.search(
          logisticsOrderLogisticsSearchParam
        );
      if (logisticsOrderLogisticsMatches.size() == 0) {
        ir.addError(
          "logisticsOrderLogisticsLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (logisticsOrderLogisticsMatches.size() > 1) {
        ir.addError(
          "logisticsOrderLogisticsLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setLogisticsOrderLogistics(
          logisticsOrderLogisticsMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“物流方式”
    if (
      !SheetUtils.isBlank(row.getLogisticsActChannelLabel()) &&
      SheetUtils.isBlank(row.getLogisticsActChannel())
    ) {
      NavLogisticsChannelViewSearchParamPo logisticsActChannelSearchParam =
        new NavLogisticsChannelViewSearchParamPo();
      logisticsActChannelSearchParam.setLimit(2); // 最大只返回二行记录
      logisticsActChannelSearchParam.setLabelEq(
        SheetUtils.trim(row.getLogisticsActChannelLabel())
      );
      logisticsActChannelSearchParam.applySqlSegments();
      List<NavLogisticsChannelViewItemVo> logisticsActChannelMatches =
        navLogisticsChannelViewMapper.search(logisticsActChannelSearchParam);
      if (logisticsActChannelMatches.size() == 0) {
        ir.addError(
          "logisticsActChannelLabel",
          "未能在物流管理-渠道基本信息-视图中找到匹配的数据"
        );
      } else if (logisticsActChannelMatches.size() > 1) {
        ir.addError(
          "logisticsActChannelLabel",
          "关联不唯一，在物流管理-渠道基本信息-视图中找到多个匹配的数据"
        );
      } else {
        vo.setLogisticsActChannel(
          logisticsActChannelMatches
            .stream()
            .map(NavLogisticsChannelViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“指定物流”
    if (
      !SheetUtils.isBlank(row.getLogisticsActProviderLabel()) &&
      SheetUtils.isBlank(row.getLogisticsActProvider())
    ) {
      NavLogisticsProviderViewSearchParamPo logisticsActProviderSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      logisticsActProviderSearchParam.setLimit(2); // 最大只返回二行记录
      logisticsActProviderSearchParam.setLabelEq(
        SheetUtils.trim(row.getLogisticsActProviderLabel())
      );
      logisticsActProviderSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> logisticsActProviderMatches =
        navLogisticsProviderViewMapper.search(logisticsActProviderSearchParam);
      if (logisticsActProviderMatches.size() == 0) {
        ir.addError(
          "logisticsActProviderLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (logisticsActProviderMatches.size() > 1) {
        ir.addError(
          "logisticsActProviderLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setLogisticsActProvider(
          logisticsActProviderMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单站点”
    if (
      !SheetUtils.isBlank(row.getAddressBaseOrderSiteName()) &&
      SheetUtils.isBlank(row.getAddressBaseOrderSite())
    ) {
      SysRegionSearchParamPo addressBaseOrderSiteSearchParam =
        new SysRegionSearchParamPo();
      addressBaseOrderSiteSearchParam.setLimit(2); // 最大只返回二行记录
      addressBaseOrderSiteSearchParam.setNameEq(
        SheetUtils.trim(row.getAddressBaseOrderSiteName())
      );
      addressBaseOrderSiteSearchParam.applySqlSegments();
      List<SysRegionItemVo> addressBaseOrderSiteMatches =
        sysRegionMapper.search(addressBaseOrderSiteSearchParam);
      if (addressBaseOrderSiteMatches.size() == 0) {
        ir.addError("addressBaseOrderSiteName", "未能在站点中找到匹配的数据");
      } else if (addressBaseOrderSiteMatches.size() > 1) {
        ir.addError(
          "addressBaseOrderSiteName",
          "关联不唯一，在站点中找到多个匹配的数据"
        );
      } else {
        vo.setAddressBaseOrderSite(
          addressBaseOrderSiteMatches
            .stream()
            .map(SysRegionItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单店铺”
    if (
      !SheetUtils.isBlank(row.getAddressBaseOrderShopInfoShopName()) &&
      SheetUtils.isBlank(row.getAddressBaseOrderShopInfo())
    ) {
      ShopInfoSearchParamPo addressBaseOrderShopInfoSearchParam =
        new ShopInfoSearchParamPo();
      addressBaseOrderShopInfoSearchParam.setLimit(2); // 最大只返回二行记录
      addressBaseOrderShopInfoSearchParam.setShopNameEq(
        SheetUtils.trim(row.getAddressBaseOrderShopInfoShopName())
      );
      addressBaseOrderShopInfoSearchParam.applySqlSegments();
      List<ShopInfoItemVo> addressBaseOrderShopInfoMatches =
        shopInfoMapper.search(addressBaseOrderShopInfoSearchParam);
      if (addressBaseOrderShopInfoMatches.size() == 0) {
        ir.addError(
          "addressBaseOrderShopInfoShopName",
          "未能在店铺中找到匹配的数据"
        );
      } else if (addressBaseOrderShopInfoMatches.size() > 1) {
        ir.addError(
          "addressBaseOrderShopInfoShopName",
          "关联不唯一，在店铺中找到多个匹配的数据"
        );
      } else {
        vo.setAddressBaseOrderShopInfo(
          addressBaseOrderShopInfoMatches
            .stream()
            .map(ShopInfoItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“发货仓库”
    if (
      !SheetUtils.isBlank(
        row.getAddressWarehouseLogisticsDeliveryWarehouseName()
      ) &&
      SheetUtils.isBlank(row.getAddressWarehouseLogisticsDeliveryWarehouse())
    ) {
      WarehouseSearchParamPo addressWarehouseLogisticsDeliveryWarehouseSearchParam =
        new WarehouseSearchParamPo();
      addressWarehouseLogisticsDeliveryWarehouseSearchParam.setLimit(2); // 最大只返回二行记录
      addressWarehouseLogisticsDeliveryWarehouseSearchParam.setNameEq(
        SheetUtils.trim(row.getAddressWarehouseLogisticsDeliveryWarehouseName())
      );
      addressWarehouseLogisticsDeliveryWarehouseSearchParam.applySqlSegments();
      List<WarehouseItemVo> addressWarehouseLogisticsDeliveryWarehouseMatches =
        warehouseMapper.search(
          addressWarehouseLogisticsDeliveryWarehouseSearchParam
        );
      if (addressWarehouseLogisticsDeliveryWarehouseMatches.size() == 0) {
        ir.addError(
          "addressWarehouseLogisticsDeliveryWarehouseName",
          "未能在仓库列表中找到匹配的数据"
        );
      } else if (addressWarehouseLogisticsDeliveryWarehouseMatches.size() > 1) {
        ir.addError(
          "addressWarehouseLogisticsDeliveryWarehouseName",
          "关联不唯一，在仓库列表中找到多个匹配的数据"
        );
      } else {
        vo.setAddressWarehouseLogisticsDeliveryWarehouse(
          addressWarehouseLogisticsDeliveryWarehouseMatches
            .stream()
            .map(WarehouseItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“物流商”
    if (
      !SheetUtils.isBlank(row.getAddressWarehouseLogisticsProviderLabel()) &&
      SheetUtils.isBlank(row.getAddressWarehouseLogisticsProvider())
    ) {
      NavLogisticsProviderViewSearchParamPo addressWarehouseLogisticsProviderSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      addressWarehouseLogisticsProviderSearchParam.setLimit(2); // 最大只返回二行记录
      addressWarehouseLogisticsProviderSearchParam.setLabelEq(
        SheetUtils.trim(row.getAddressWarehouseLogisticsProviderLabel())
      );
      addressWarehouseLogisticsProviderSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> addressWarehouseLogisticsProviderMatches =
        navLogisticsProviderViewMapper.search(
          addressWarehouseLogisticsProviderSearchParam
        );
      if (addressWarehouseLogisticsProviderMatches.size() == 0) {
        ir.addError(
          "addressWarehouseLogisticsProviderLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (addressWarehouseLogisticsProviderMatches.size() > 1) {
        ir.addError(
          "addressWarehouseLogisticsProviderLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setAddressWarehouseLogisticsProvider(
          addressWarehouseLogisticsProviderMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“物流方式”
    if (
      !SheetUtils.isBlank(row.getAddressWarehouseLogisticsChannelLabel()) &&
      SheetUtils.isBlank(row.getAddressWarehouseLogisticsChannel())
    ) {
      NavLogisticsChannelViewSearchParamPo addressWarehouseLogisticsChannelSearchParam =
        new NavLogisticsChannelViewSearchParamPo();
      addressWarehouseLogisticsChannelSearchParam.setLimit(2); // 最大只返回二行记录
      addressWarehouseLogisticsChannelSearchParam.setLabelEq(
        SheetUtils.trim(row.getAddressWarehouseLogisticsChannelLabel())
      );
      addressWarehouseLogisticsChannelSearchParam.applySqlSegments();
      List<NavLogisticsChannelViewItemVo> addressWarehouseLogisticsChannelMatches =
        navLogisticsChannelViewMapper.search(
          addressWarehouseLogisticsChannelSearchParam
        );
      if (addressWarehouseLogisticsChannelMatches.size() == 0) {
        ir.addError(
          "addressWarehouseLogisticsChannelLabel",
          "未能在物流管理-渠道基本信息-视图中找到匹配的数据"
        );
      } else if (addressWarehouseLogisticsChannelMatches.size() > 1) {
        ir.addError(
          "addressWarehouseLogisticsChannelLabel",
          "关联不唯一，在物流管理-渠道基本信息-视图中找到多个匹配的数据"
        );
      } else {
        vo.setAddressWarehouseLogisticsChannel(
          addressWarehouseLogisticsChannelMatches
            .stream()
            .map(NavLogisticsChannelViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“收货国家/地区”
    if (
      !SheetUtils.isBlank(row.getAddressWarehouseLogisticsCountryCountry()) &&
      SheetUtils.isBlank(row.getAddressWarehouseLogisticsCountry())
    ) {
      SysCountrySearchParamPo addressWarehouseLogisticsCountrySearchParam =
        new SysCountrySearchParamPo();
      addressWarehouseLogisticsCountrySearchParam.setLimit(2); // 最大只返回二行记录
      addressWarehouseLogisticsCountrySearchParam.setCountryEq(
        SheetUtils.trim(row.getAddressWarehouseLogisticsCountryCountry())
      );
      addressWarehouseLogisticsCountrySearchParam.applySqlSegments();
      List<SysCountryItemVo> addressWarehouseLogisticsCountryMatches =
        sysCountryMapper.search(addressWarehouseLogisticsCountrySearchParam);
      if (addressWarehouseLogisticsCountryMatches.size() == 0) {
        ir.addError(
          "addressWarehouseLogisticsCountryCountry",
          "未能在国家中找到匹配的数据"
        );
      } else if (addressWarehouseLogisticsCountryMatches.size() > 1) {
        ir.addError(
          "addressWarehouseLogisticsCountryCountry",
          "关联不唯一，在国家中找到多个匹配的数据"
        );
      } else {
        vo.setAddressWarehouseLogisticsCountry(
          addressWarehouseLogisticsCountryMatches
            .stream()
            .map(SysCountryItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单产品”
    if (
      !SheetUtils.isBlank(row.getAddressOrderProductName()) &&
      SheetUtils.isBlank(row.getAddressOrderProduct())
    ) {
      ProductSearchParamPo addressOrderProductSearchParam =
        new ProductSearchParamPo();
      addressOrderProductSearchParam.setLimit(2); // 最大只返回二行记录
      addressOrderProductSearchParam.setNameEq(
        SheetUtils.trim(row.getAddressOrderProductName())
      );
      addressOrderProductSearchParam.applySqlSegments();
      List<ProductItemVo> addressOrderProductMatches = productMapper.search(
        addressOrderProductSearchParam
      );
      if (addressOrderProductMatches.size() == 0) {
        ir.addError(
          "addressOrderProductName",
          "未能在产品管理中找到匹配的数据"
        );
      } else if (addressOrderProductMatches.size() > 1) {
        ir.addError(
          "addressOrderProductName",
          "关联不唯一，在产品管理中找到多个匹配的数据"
        );
      } else {
        vo.setAddressOrderProduct(
          addressOrderProductMatches
            .stream()
            .map(ProductItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“产品分类”
    if (
      !SheetUtils.isBlank(row.getAddressOrderProductClassifyName()) &&
      SheetUtils.isBlank(row.getAddressOrderProductClassify())
    ) {
      ClassifySearchParamPo addressOrderProductClassifySearchParam =
        new ClassifySearchParamPo();
      addressOrderProductClassifySearchParam.setLimit(2); // 最大只返回二行记录
      addressOrderProductClassifySearchParam.setNameEq(
        SheetUtils.trim(row.getAddressOrderProductClassifyName())
      );
      addressOrderProductClassifySearchParam.applySqlSegments();
      List<ClassifyItemVo> addressOrderProductClassifyMatches =
        classifyMapper.search(addressOrderProductClassifySearchParam);
      if (addressOrderProductClassifyMatches.size() == 0) {
        ir.addError(
          "addressOrderProductClassifyName",
          "未能在分类管理中找到匹配的数据"
        );
      } else if (addressOrderProductClassifyMatches.size() > 1) {
        ir.addError(
          "addressOrderProductClassifyName",
          "关联不唯一，在分类管理中找到多个匹配的数据"
        );
      } else {
        vo.setAddressOrderProductClassify(
          addressOrderProductClassifyMatches
            .stream()
            .map(ClassifyItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“客选物流”
    if (
      !SheetUtils.isBlank(row.getAddressOrderLogisticsLabel()) &&
      SheetUtils.isBlank(row.getAddressOrderLogistics())
    ) {
      NavLogisticsProviderViewSearchParamPo addressOrderLogisticsSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      addressOrderLogisticsSearchParam.setLimit(2); // 最大只返回二行记录
      addressOrderLogisticsSearchParam.setLabelEq(
        SheetUtils.trim(row.getAddressOrderLogisticsLabel())
      );
      addressOrderLogisticsSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> addressOrderLogisticsMatches =
        navLogisticsProviderViewMapper.search(addressOrderLogisticsSearchParam);
      if (addressOrderLogisticsMatches.size() == 0) {
        ir.addError(
          "addressOrderLogisticsLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (addressOrderLogisticsMatches.size() > 1) {
        ir.addError(
          "addressOrderLogisticsLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setAddressOrderLogistics(
          addressOrderLogisticsMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单站点”
    if (
      !SheetUtils.isBlank(row.getProcessBaseOrderSiteName()) &&
      SheetUtils.isBlank(row.getProcessBaseOrderSite())
    ) {
      SysRegionSearchParamPo processBaseOrderSiteSearchParam =
        new SysRegionSearchParamPo();
      processBaseOrderSiteSearchParam.setLimit(2); // 最大只返回二行记录
      processBaseOrderSiteSearchParam.setNameEq(
        SheetUtils.trim(row.getProcessBaseOrderSiteName())
      );
      processBaseOrderSiteSearchParam.applySqlSegments();
      List<SysRegionItemVo> processBaseOrderSiteMatches =
        sysRegionMapper.search(processBaseOrderSiteSearchParam);
      if (processBaseOrderSiteMatches.size() == 0) {
        ir.addError("processBaseOrderSiteName", "未能在站点中找到匹配的数据");
      } else if (processBaseOrderSiteMatches.size() > 1) {
        ir.addError(
          "processBaseOrderSiteName",
          "关联不唯一，在站点中找到多个匹配的数据"
        );
      } else {
        vo.setProcessBaseOrderSite(
          processBaseOrderSiteMatches
            .stream()
            .map(SysRegionItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单店铺”
    if (
      !SheetUtils.isBlank(row.getProcessBaseOrderShopInfoShopName()) &&
      SheetUtils.isBlank(row.getProcessBaseOrderShopInfo())
    ) {
      ShopInfoSearchParamPo processBaseOrderShopInfoSearchParam =
        new ShopInfoSearchParamPo();
      processBaseOrderShopInfoSearchParam.setLimit(2); // 最大只返回二行记录
      processBaseOrderShopInfoSearchParam.setShopNameEq(
        SheetUtils.trim(row.getProcessBaseOrderShopInfoShopName())
      );
      processBaseOrderShopInfoSearchParam.applySqlSegments();
      List<ShopInfoItemVo> processBaseOrderShopInfoMatches =
        shopInfoMapper.search(processBaseOrderShopInfoSearchParam);
      if (processBaseOrderShopInfoMatches.size() == 0) {
        ir.addError(
          "processBaseOrderShopInfoShopName",
          "未能在店铺中找到匹配的数据"
        );
      } else if (processBaseOrderShopInfoMatches.size() > 1) {
        ir.addError(
          "processBaseOrderShopInfoShopName",
          "关联不唯一，在店铺中找到多个匹配的数据"
        );
      } else {
        vo.setProcessBaseOrderShopInfo(
          processBaseOrderShopInfoMatches
            .stream()
            .map(ShopInfoItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“发货仓库”
    if (
      !SheetUtils.isBlank(
        row.getProcessWarehouseLogisticsDeliveryWarehouseName()
      ) &&
      SheetUtils.isBlank(row.getProcessWarehouseLogisticsDeliveryWarehouse())
    ) {
      WarehouseSearchParamPo processWarehouseLogisticsDeliveryWarehouseSearchParam =
        new WarehouseSearchParamPo();
      processWarehouseLogisticsDeliveryWarehouseSearchParam.setLimit(2); // 最大只返回二行记录
      processWarehouseLogisticsDeliveryWarehouseSearchParam.setNameEq(
        SheetUtils.trim(row.getProcessWarehouseLogisticsDeliveryWarehouseName())
      );
      processWarehouseLogisticsDeliveryWarehouseSearchParam.applySqlSegments();
      List<WarehouseItemVo> processWarehouseLogisticsDeliveryWarehouseMatches =
        warehouseMapper.search(
          processWarehouseLogisticsDeliveryWarehouseSearchParam
        );
      if (processWarehouseLogisticsDeliveryWarehouseMatches.size() == 0) {
        ir.addError(
          "processWarehouseLogisticsDeliveryWarehouseName",
          "未能在仓库列表中找到匹配的数据"
        );
      } else if (processWarehouseLogisticsDeliveryWarehouseMatches.size() > 1) {
        ir.addError(
          "processWarehouseLogisticsDeliveryWarehouseName",
          "关联不唯一，在仓库列表中找到多个匹配的数据"
        );
      } else {
        vo.setProcessWarehouseLogisticsDeliveryWarehouse(
          processWarehouseLogisticsDeliveryWarehouseMatches
            .stream()
            .map(WarehouseItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“物流商”
    if (
      !SheetUtils.isBlank(row.getProcessWarehouseLogisticsProviderLabel()) &&
      SheetUtils.isBlank(row.getProcessWarehouseLogisticsProvider())
    ) {
      NavLogisticsProviderViewSearchParamPo processWarehouseLogisticsProviderSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      processWarehouseLogisticsProviderSearchParam.setLimit(2); // 最大只返回二行记录
      processWarehouseLogisticsProviderSearchParam.setLabelEq(
        SheetUtils.trim(row.getProcessWarehouseLogisticsProviderLabel())
      );
      processWarehouseLogisticsProviderSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> processWarehouseLogisticsProviderMatches =
        navLogisticsProviderViewMapper.search(
          processWarehouseLogisticsProviderSearchParam
        );
      if (processWarehouseLogisticsProviderMatches.size() == 0) {
        ir.addError(
          "processWarehouseLogisticsProviderLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (processWarehouseLogisticsProviderMatches.size() > 1) {
        ir.addError(
          "processWarehouseLogisticsProviderLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setProcessWarehouseLogisticsProvider(
          processWarehouseLogisticsProviderMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“物流方式”
    if (
      !SheetUtils.isBlank(row.getProcessWarehouseLogisticsChannelLabel()) &&
      SheetUtils.isBlank(row.getProcessWarehouseLogisticsChannel())
    ) {
      NavLogisticsChannelViewSearchParamPo processWarehouseLogisticsChannelSearchParam =
        new NavLogisticsChannelViewSearchParamPo();
      processWarehouseLogisticsChannelSearchParam.setLimit(2); // 最大只返回二行记录
      processWarehouseLogisticsChannelSearchParam.setLabelEq(
        SheetUtils.trim(row.getProcessWarehouseLogisticsChannelLabel())
      );
      processWarehouseLogisticsChannelSearchParam.applySqlSegments();
      List<NavLogisticsChannelViewItemVo> processWarehouseLogisticsChannelMatches =
        navLogisticsChannelViewMapper.search(
          processWarehouseLogisticsChannelSearchParam
        );
      if (processWarehouseLogisticsChannelMatches.size() == 0) {
        ir.addError(
          "processWarehouseLogisticsChannelLabel",
          "未能在物流管理-渠道基本信息-视图中找到匹配的数据"
        );
      } else if (processWarehouseLogisticsChannelMatches.size() > 1) {
        ir.addError(
          "processWarehouseLogisticsChannelLabel",
          "关联不唯一，在物流管理-渠道基本信息-视图中找到多个匹配的数据"
        );
      } else {
        vo.setProcessWarehouseLogisticsChannel(
          processWarehouseLogisticsChannelMatches
            .stream()
            .map(NavLogisticsChannelViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“收货国家/地区”
    if (
      !SheetUtils.isBlank(row.getProcessWarehouseLogisticsCountryCountry()) &&
      SheetUtils.isBlank(row.getProcessWarehouseLogisticsCountry())
    ) {
      SysCountrySearchParamPo processWarehouseLogisticsCountrySearchParam =
        new SysCountrySearchParamPo();
      processWarehouseLogisticsCountrySearchParam.setLimit(2); // 最大只返回二行记录
      processWarehouseLogisticsCountrySearchParam.setCountryEq(
        SheetUtils.trim(row.getProcessWarehouseLogisticsCountryCountry())
      );
      processWarehouseLogisticsCountrySearchParam.applySqlSegments();
      List<SysCountryItemVo> processWarehouseLogisticsCountryMatches =
        sysCountryMapper.search(processWarehouseLogisticsCountrySearchParam);
      if (processWarehouseLogisticsCountryMatches.size() == 0) {
        ir.addError(
          "processWarehouseLogisticsCountryCountry",
          "未能在国家中找到匹配的数据"
        );
      } else if (processWarehouseLogisticsCountryMatches.size() > 1) {
        ir.addError(
          "processWarehouseLogisticsCountryCountry",
          "关联不唯一，在国家中找到多个匹配的数据"
        );
      } else {
        vo.setProcessWarehouseLogisticsCountry(
          processWarehouseLogisticsCountryMatches
            .stream()
            .map(SysCountryItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单产品”
    if (
      !SheetUtils.isBlank(row.getProcessOrderProductName()) &&
      SheetUtils.isBlank(row.getProcessOrderProduct())
    ) {
      ProductSearchParamPo processOrderProductSearchParam =
        new ProductSearchParamPo();
      processOrderProductSearchParam.setLimit(2); // 最大只返回二行记录
      processOrderProductSearchParam.setNameEq(
        SheetUtils.trim(row.getProcessOrderProductName())
      );
      processOrderProductSearchParam.applySqlSegments();
      List<ProductItemVo> processOrderProductMatches = productMapper.search(
        processOrderProductSearchParam
      );
      if (processOrderProductMatches.size() == 0) {
        ir.addError(
          "processOrderProductName",
          "未能在产品管理中找到匹配的数据"
        );
      } else if (processOrderProductMatches.size() > 1) {
        ir.addError(
          "processOrderProductName",
          "关联不唯一，在产品管理中找到多个匹配的数据"
        );
      } else {
        vo.setProcessOrderProduct(
          processOrderProductMatches
            .stream()
            .map(ProductItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“产品分类”
    if (
      !SheetUtils.isBlank(row.getProcessOrderProductClassifyName()) &&
      SheetUtils.isBlank(row.getProcessOrderProductClassify())
    ) {
      ClassifySearchParamPo processOrderProductClassifySearchParam =
        new ClassifySearchParamPo();
      processOrderProductClassifySearchParam.setLimit(2); // 最大只返回二行记录
      processOrderProductClassifySearchParam.setNameEq(
        SheetUtils.trim(row.getProcessOrderProductClassifyName())
      );
      processOrderProductClassifySearchParam.applySqlSegments();
      List<ClassifyItemVo> processOrderProductClassifyMatches =
        classifyMapper.search(processOrderProductClassifySearchParam);
      if (processOrderProductClassifyMatches.size() == 0) {
        ir.addError(
          "processOrderProductClassifyName",
          "未能在分类管理中找到匹配的数据"
        );
      } else if (processOrderProductClassifyMatches.size() > 1) {
        ir.addError(
          "processOrderProductClassifyName",
          "关联不唯一，在分类管理中找到多个匹配的数据"
        );
      } else {
        vo.setProcessOrderProductClassify(
          processOrderProductClassifyMatches
            .stream()
            .map(ClassifyItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“客选物流”
    if (
      !SheetUtils.isBlank(row.getProcessOrderLogisticsLabel()) &&
      SheetUtils.isBlank(row.getProcessOrderLogistics())
    ) {
      NavLogisticsProviderViewSearchParamPo processOrderLogisticsSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      processOrderLogisticsSearchParam.setLimit(2); // 最大只返回二行记录
      processOrderLogisticsSearchParam.setLabelEq(
        SheetUtils.trim(row.getProcessOrderLogisticsLabel())
      );
      processOrderLogisticsSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> processOrderLogisticsMatches =
        navLogisticsProviderViewMapper.search(processOrderLogisticsSearchParam);
      if (processOrderLogisticsMatches.size() == 0) {
        ir.addError(
          "processOrderLogisticsLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (processOrderLogisticsMatches.size() > 1) {
        ir.addError(
          "processOrderLogisticsLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setProcessOrderLogistics(
          processOrderLogisticsMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单站点”
    if (
      !SheetUtils.isBlank(row.getIssuBaseOrderSiteName()) &&
      SheetUtils.isBlank(row.getIssuBaseOrderSite())
    ) {
      SysRegionSearchParamPo issuBaseOrderSiteSearchParam =
        new SysRegionSearchParamPo();
      issuBaseOrderSiteSearchParam.setLimit(2); // 最大只返回二行记录
      issuBaseOrderSiteSearchParam.setNameEq(
        SheetUtils.trim(row.getIssuBaseOrderSiteName())
      );
      issuBaseOrderSiteSearchParam.applySqlSegments();
      List<SysRegionItemVo> issuBaseOrderSiteMatches = sysRegionMapper.search(
        issuBaseOrderSiteSearchParam
      );
      if (issuBaseOrderSiteMatches.size() == 0) {
        ir.addError("issuBaseOrderSiteName", "未能在站点中找到匹配的数据");
      } else if (issuBaseOrderSiteMatches.size() > 1) {
        ir.addError(
          "issuBaseOrderSiteName",
          "关联不唯一，在站点中找到多个匹配的数据"
        );
      } else {
        vo.setIssuBaseOrderSite(
          issuBaseOrderSiteMatches
            .stream()
            .map(SysRegionItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“订单店铺”
    if (
      !SheetUtils.isBlank(row.getIssuBaseOrderShopInfoShopName()) &&
      SheetUtils.isBlank(row.getIssuBaseOrderShopInfo())
    ) {
      ShopInfoSearchParamPo issuBaseOrderShopInfoSearchParam =
        new ShopInfoSearchParamPo();
      issuBaseOrderShopInfoSearchParam.setLimit(2); // 最大只返回二行记录
      issuBaseOrderShopInfoSearchParam.setShopNameEq(
        SheetUtils.trim(row.getIssuBaseOrderShopInfoShopName())
      );
      issuBaseOrderShopInfoSearchParam.applySqlSegments();
      List<ShopInfoItemVo> issuBaseOrderShopInfoMatches = shopInfoMapper.search(
        issuBaseOrderShopInfoSearchParam
      );
      if (issuBaseOrderShopInfoMatches.size() == 0) {
        ir.addError(
          "issuBaseOrderShopInfoShopName",
          "未能在店铺中找到匹配的数据"
        );
      } else if (issuBaseOrderShopInfoMatches.size() > 1) {
        ir.addError(
          "issuBaseOrderShopInfoShopName",
          "关联不唯一，在店铺中找到多个匹配的数据"
        );
      } else {
        vo.setIssuBaseOrderShopInfo(
          issuBaseOrderShopInfoMatches
            .stream()
            .map(ShopInfoItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“发货仓库”
    if (
      !SheetUtils.isBlank(
        row.getIssuWarehouseLogisticsDeliveryWarehouseName()
      ) &&
      SheetUtils.isBlank(row.getIssuWarehouseLogisticsDeliveryWarehouse())
    ) {
      WarehouseSearchParamPo issuWarehouseLogisticsDeliveryWarehouseSearchParam =
        new WarehouseSearchParamPo();
      issuWarehouseLogisticsDeliveryWarehouseSearchParam.setLimit(2); // 最大只返回二行记录
      issuWarehouseLogisticsDeliveryWarehouseSearchParam.setNameEq(
        SheetUtils.trim(row.getIssuWarehouseLogisticsDeliveryWarehouseName())
      );
      issuWarehouseLogisticsDeliveryWarehouseSearchParam.applySqlSegments();
      List<WarehouseItemVo> issuWarehouseLogisticsDeliveryWarehouseMatches =
        warehouseMapper.search(
          issuWarehouseLogisticsDeliveryWarehouseSearchParam
        );
      if (issuWarehouseLogisticsDeliveryWarehouseMatches.size() == 0) {
        ir.addError(
          "issuWarehouseLogisticsDeliveryWarehouseName",
          "未能在仓库列表中找到匹配的数据"
        );
      } else if (issuWarehouseLogisticsDeliveryWarehouseMatches.size() > 1) {
        ir.addError(
          "issuWarehouseLogisticsDeliveryWarehouseName",
          "关联不唯一，在仓库列表中找到多个匹配的数据"
        );
      } else {
        vo.setIssuWarehouseLogisticsDeliveryWarehouse(
          issuWarehouseLogisticsDeliveryWarehouseMatches
            .stream()
            .map(WarehouseItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“物流商”
    if (
      !SheetUtils.isBlank(row.getIssuWarehouseLogisticsProviderLabel()) &&
      SheetUtils.isBlank(row.getIssuWarehouseLogisticsProvider())
    ) {
      NavLogisticsProviderViewSearchParamPo issuWarehouseLogisticsProviderSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      issuWarehouseLogisticsProviderSearchParam.setLimit(2); // 最大只返回二行记录
      issuWarehouseLogisticsProviderSearchParam.setLabelEq(
        SheetUtils.trim(row.getIssuWarehouseLogisticsProviderLabel())
      );
      issuWarehouseLogisticsProviderSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> issuWarehouseLogisticsProviderMatches =
        navLogisticsProviderViewMapper.search(
          issuWarehouseLogisticsProviderSearchParam
        );
      if (issuWarehouseLogisticsProviderMatches.size() == 0) {
        ir.addError(
          "issuWarehouseLogisticsProviderLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (issuWarehouseLogisticsProviderMatches.size() > 1) {
        ir.addError(
          "issuWarehouseLogisticsProviderLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setIssuWarehouseLogisticsProvider(
          issuWarehouseLogisticsProviderMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“物流方式”
    if (
      !SheetUtils.isBlank(row.getIssuWarehouseLogisticsChannelLabel()) &&
      SheetUtils.isBlank(row.getIssuWarehouseLogisticsChannel())
    ) {
      NavLogisticsChannelViewSearchParamPo issuWarehouseLogisticsChannelSearchParam =
        new NavLogisticsChannelViewSearchParamPo();
      issuWarehouseLogisticsChannelSearchParam.setLimit(2); // 最大只返回二行记录
      issuWarehouseLogisticsChannelSearchParam.setLabelEq(
        SheetUtils.trim(row.getIssuWarehouseLogisticsChannelLabel())
      );
      issuWarehouseLogisticsChannelSearchParam.applySqlSegments();
      List<NavLogisticsChannelViewItemVo> issuWarehouseLogisticsChannelMatches =
        navLogisticsChannelViewMapper.search(
          issuWarehouseLogisticsChannelSearchParam
        );
      if (issuWarehouseLogisticsChannelMatches.size() == 0) {
        ir.addError(
          "issuWarehouseLogisticsChannelLabel",
          "未能在物流管理-渠道基本信息-视图中找到匹配的数据"
        );
      } else if (issuWarehouseLogisticsChannelMatches.size() > 1) {
        ir.addError(
          "issuWarehouseLogisticsChannelLabel",
          "关联不唯一，在物流管理-渠道基本信息-视图中找到多个匹配的数据"
        );
      } else {
        vo.setIssuWarehouseLogisticsChannel(
          issuWarehouseLogisticsChannelMatches
            .stream()
            .map(NavLogisticsChannelViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }
    // 处理关联字段“客选物流”
    if (
      !SheetUtils.isBlank(row.getIssuOrderLogisticsLabel()) &&
      SheetUtils.isBlank(row.getIssuOrderLogistics())
    ) {
      NavLogisticsProviderViewSearchParamPo issuOrderLogisticsSearchParam =
        new NavLogisticsProviderViewSearchParamPo();
      issuOrderLogisticsSearchParam.setLimit(2); // 最大只返回二行记录
      issuOrderLogisticsSearchParam.setLabelEq(
        SheetUtils.trim(row.getIssuOrderLogisticsLabel())
      );
      issuOrderLogisticsSearchParam.applySqlSegments();
      List<NavLogisticsProviderViewItemVo> issuOrderLogisticsMatches =
        navLogisticsProviderViewMapper.search(issuOrderLogisticsSearchParam);
      if (issuOrderLogisticsMatches.size() == 0) {
        ir.addError(
          "issuOrderLogisticsLabel",
          "未能在物流管理-客选物流-视图中找到匹配的数据"
        );
      } else if (issuOrderLogisticsMatches.size() > 1) {
        ir.addError(
          "issuOrderLogisticsLabel",
          "关联不唯一，在物流管理-客选物流-视图中找到多个匹配的数据"
        );
      } else {
        vo.setIssuOrderLogistics(
          issuOrderLogisticsMatches
            .stream()
            .map(NavLogisticsProviderViewItemVo::getId)
            .collect(Collectors.toList())
        );
      }
    }

    return ir;
  }

  /**
   * 导入预览
   * @param sysFile 已上传到系统的文件
   * @param templateId 要使用的模版编号
   * @param allowOverrides 允许覆盖
   */
  @Override
  public List<ImportRow<OrderRuleImportPo>> importPreview(
    SysFile sysFile,
    Long templateId,
    boolean allowOverrides
  ) throws Exception {
    SysImportTemplate importTemplate = null;
    if (templateId != null && templateId > 0) {
      importTemplate = importTemplateService.getById(templateId);
      if (importTemplate == null) {
        throw new RException("指定的模版不可用！");
      }
    }
    Map<String, Object> variables = new HashMap<>();

    // 标记由模版直接导入的字段集
    if (importTemplate != null) {
      variables.put(
        "IMPORT_FIELDS",
        importTemplate
          .getSetting()
          .getMappings()
          .stream()
          .map(SysImportTemplate.Mapping::getField)
          .collect(Collectors.toSet())
      );
    }
    try (InputStream in = fileService.read(sysFile)) {
      List<ImportRow<OrderRuleImportPo>> rows = new ArrayList<>();

      // 读取 Excel 到 rows
      EasyExcel
        .read(in)
        .useDefaultListener(false)
        .registerReadListener(
          new TemplateModelBuildEventListener<>(
            OrderRuleImportPo.class,
            importTemplate
          ) {
            @Override
            public void invokeRow(OrderRuleImportPo row, AnalysisContext cxt) {
              OrderRuleVo vo = new OrderRuleVo();
              ImportRow<OrderRuleImportPo> ir = excelToImportRow(
                row,
                cxt.readRowHolder().getRowIndex(),
                vo,
                variables,
                allowOverrides
              );
              if (ir.isEmptyRow()) {
                return;
              }
              if (allowOverrides) {
                // FIXME: 未在平台上配置此对象《作为导入唯一识别》的《逻辑分组》配置，无法处理更新模式
              }
              rows.add(ir);
            }
          }
        )
        .sheet()
        .doRead();

      return rows;
    }
  }

  /**
   * 完成导入
   * @param rows 预导入的行信息
   */
  @DataActivity(action = SysDataActivityAction.Import)
  @Transactional(rollbackFor = Exception.class)
  @Override
  public void importDone(
    List<ImportRow<OrderRuleImportPo>> rows,
    Long templateId
  ) throws Exception {
    SysImportTemplate importTemplate = null;
    if (templateId != null && templateId > 0) {
      importTemplate = importTemplateService.getById(templateId);
      if (importTemplate == null) {
        throw new RException("指定的模版不可用！");
      }
    }
    String sysImportBatchNo = StrUtil.concat(
      true,
      DateUtil.format(DateUtil.date(), DatePattern.PURE_DATETIME_MS_PATTERN),
      IdUtil.nanoId(4)
    );
    List<Long> importedIdList = new ArrayList<>();
    SysDataActivityAopHelper.clear();
    final SysDataActivityAopHelper.DataActivityAopContext context =
      SysDataActivityAopHelper.getOrCreateContext();
    Map<String, Object> variables = new HashMap<>();

    // 标记由模版直接导入的字段集
    if (importTemplate != null) {
      variables.put(
        "IMPORT_FIELDS",
        importTemplate
          .getSetting()
          .getMappings()
          .stream()
          .map(SysImportTemplate.Mapping::getField)
          .collect(Collectors.toSet())
      );
    }
    for (int i = 0; i < rows.size(); i++) {
      ImportRow<OrderRuleImportPo> row = rows.get(i);
      Long updateId = row.getUpdateId();
      OrderRuleVo vo = new OrderRuleVo();
      row =
        excelToImportRow(row.getRow(), row.getRowNumber(), vo, variables, true);
      if (row.getErrors() != null && row.getErrors().size() > 0) {
        throw new RException(
          String.format(
            "第%d行（Excel第%d行）数据验证错误：%s",
            i + 1,
            row.getRowNumber(),
            row.getJoinErrorMessage()
          )
        );
      }
      if (updateId != null) {
        vo.setId(updateId);
      }
      SheetUtils.setSysImportTemplateName(
        vo,
        null == importTemplate ? "默认模板" : importTemplate.getTitle()
      );
      SheetUtils.setSysImportBatchNo(vo, sysImportBatchNo);
      if (updateId == null) {
        importedIdList.add(create(vo));
      } else {
        self.update(vo);
        importedIdList.add(vo.getId());
      }
    }
    context.getIdList().addAll(importedIdList);
  }

  /**
   * 导出
   * @param templateId 使用模版（可以是 null 或 0 表示系统默认导出模版）
   * @param search 查询条件
   */
  @DataActivity(action = SysDataActivityAction.Export)
  @Override
  public void export(
    Long templateId,
    OrderRuleSearchParamPo search,
    HttpServletResponse response
  ) throws Exception {
    if (templateId != null && templateId > 0) {
      SysImportTemplate sysImportTemplate = importTemplateService.getById(
        templateId
      );
      if (sysImportTemplate == null) {
        throw new RException("所选的导出模版不可用");
      }
      CustomExcelExport.CustomExcelExportOptions exportOptions =
        new CustomExcelExport.CustomExcelExportOptions();
      exportOptions.setImportTemplate(sysImportTemplate);
      exportOptions.setSearchParam(search);
      exportOptions.setMainService(this);
      exportOptions.addFieldMappingOption(
        "type",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM10117")
      );
      exportOptions.addFieldMappingOption(
        "status",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00134")
      );
      exportOptions.addFieldMappingOption(
        "splitSplitMode",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00118")
      );
      exportOptions.addFieldMappingOption(
        "splitBaseOrderOriginal",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00121")
      );
      exportOptions.addFieldMappingOption(
        "splitBaseOrderType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00122")
      );
      exportOptions.addFieldMappingOption(
        "splitBaseOrderPlatform",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00106")
      );
      exportOptions.addFieldMappingOption(
        "splitBaseOrderSite",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getSplitBaseOrderSiteName())
          )
      );
      exportOptions.addFieldMappingOption(
        "splitBaseOrderShopInfo",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getSplitBaseOrderShopInfoShopName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "splitWarehouseLogisticsCountry",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getSplitWarehouseLogisticsCountryCountry()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "splitWarehouseLogisticsChooseOne",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00008")
      );
      exportOptions.addFieldMappingOption(
        "splitWarehouseLogisticsAddressType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00124")
      );
      exportOptions.addFieldMappingOption(
        "splitOrderProduct",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getSplitOrderProductName())
          )
      );
      exportOptions.addFieldMappingOption(
        "splitOrderProductClassify",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getSplitOrderProductClassifyName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "splitOrderMode",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00129")
      );
      exportOptions.addFieldMappingOption(
        "splitOrderProductStatus",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00006")
      );
      exportOptions.addFieldMappingOption(
        "splitOrderLogistics",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getSplitOrderLogisticsLabel())
          )
      );
      exportOptions.addFieldMappingOption(
        "splitOrderSpecial",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00009")
      );
      exportOptions.addFieldMappingOption(
        "splitAct",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00128")
      );
      exportOptions.addFieldMappingOption(
        "splitActMode",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00126")
      );
      exportOptions.addFieldMappingOption(
        "joinBaseOrderType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00122")
      );
      exportOptions.addFieldMappingOption(
        "joinBaseOrderPlatform",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00106")
      );
      exportOptions.addFieldMappingOption(
        "joinBaseOrderSite",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getJoinBaseOrderSiteName())
          )
      );
      exportOptions.addFieldMappingOption(
        "joinBaseOrderShopInfo",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getJoinBaseOrderShopInfoShopName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "joinWarehouseLogisticsAddressType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00124")
      );
      exportOptions.addFieldMappingOption(
        "joinOrderProduct",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getJoinOrderProductName())
          )
      );
      exportOptions.addFieldMappingOption(
        "joinOrderProductClassify",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getJoinOrderProductClassifyName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "joinOrderMode",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00129")
      );
      exportOptions.addFieldMappingOption(
        "joinOrderLogistics",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getJoinOrderLogisticsLabel())
          )
      );
      exportOptions.addFieldMappingOption(
        "joinOrderSpecial",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00009")
      );
      exportOptions.addFieldMappingOption(
        "joinActMode",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00125")
      );
      exportOptions.addFieldMappingOption(
        "warehouseBaseOrderPlatform",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00106")
      );
      exportOptions.addFieldMappingOption(
        "warehouseBaseOrderSite",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getWarehouseBaseOrderSiteName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "warehouseBaseOrderShopInfo",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getWarehouseBaseOrderShopInfoShopName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "warehouseWarehouseLogisticsCountry",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              (
                (OrderRuleItemVo) r
              ).getWarehouseWarehouseLogisticsCountryCountry()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "warehouseWarehouseLogisticsChooseOne",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00008")
      );
      exportOptions.addFieldMappingOption(
        "warehouseWarehouseLogisticsAddressType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00124")
      );
      exportOptions.addFieldMappingOption(
        "warehouseOrderProduct",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getWarehouseOrderProductName())
          )
      );
      exportOptions.addFieldMappingOption(
        "warehouseOrderProductClassify",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getWarehouseOrderProductClassifyName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "warehouseOrderLogistics",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getWarehouseOrderLogisticsLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "warehouseOrderSpecial",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00009")
      );
      exportOptions.addFieldMappingOption(
        "warehouseActDeliveryWarehouse",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getWarehouseActDeliveryWarehouseName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "warehouseActOptionWarehouse",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getWarehouseActOptionWarehouseName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "warehouseActAutoCoverOriginal",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00008")
      );
      exportOptions.addFieldMappingOption(
        "warehouseActInventoryDeductionType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00127")
      );
      exportOptions.addFieldMappingOption(
        "logisticsBaseOrderPlatform",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00106")
      );
      exportOptions.addFieldMappingOption(
        "logisticsBaseOrderSite",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getLogisticsBaseOrderSiteName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "logisticsBaseOrderShopInfo",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getLogisticsBaseOrderShopInfoShopName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "logisticsWarehouseLogisticsCountry",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              (
                (OrderRuleItemVo) r
              ).getLogisticsWarehouseLogisticsCountryCountry()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "logisticsWarehouseLogisticsChooseOne",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00008")
      );
      exportOptions.addFieldMappingOption(
        "logisticsWarehouseLogisticsAddressType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00124")
      );
      exportOptions.addFieldMappingOption(
        "logisticsOrderProduct",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getLogisticsOrderProductName())
          )
      );
      exportOptions.addFieldMappingOption(
        "logisticsOrderProductClassify",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getLogisticsOrderProductClassifyName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "logisticsOrderLogistics",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getLogisticsOrderLogisticsLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "logisticsOrderSpecial",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00009")
      );
      exportOptions.addFieldMappingOption(
        "logisticsActSettingMethod",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00119")
      );
      exportOptions.addFieldMappingOption(
        "logisticsActChannel",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getLogisticsActChannelLabel())
          )
      );
      exportOptions.addFieldMappingOption(
        "logisticsActOverseasWarehouseAutoMapping",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00008")
      );
      exportOptions.addFieldMappingOption(
        "logisticsActAutoCoverOriginal",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00008")
      );
      exportOptions.addFieldMappingOption(
        "logisticsActPriceParity",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00120")
      );
      exportOptions.addFieldMappingOption(
        "logisticsActProvider",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getLogisticsActProviderLabel())
          )
      );
      exportOptions.addFieldMappingOption(
        "addressBaseSource",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00121")
      );
      exportOptions.addFieldMappingOption(
        "addressBaseOrderPlatform",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00106")
      );
      exportOptions.addFieldMappingOption(
        "addressBaseOrderSite",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getAddressBaseOrderSiteName())
          )
      );
      exportOptions.addFieldMappingOption(
        "addressBaseOrderShopInfo",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getAddressBaseOrderShopInfoShopName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "addressWarehouseLogisticsDeliveryWarehouse",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              (
                (OrderRuleItemVo) r
              ).getAddressWarehouseLogisticsDeliveryWarehouseName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "addressWarehouseLogisticsProvider",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getAddressWarehouseLogisticsProviderLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "addressWarehouseLogisticsChannel",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getAddressWarehouseLogisticsChannelLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "addressWarehouseLogisticsCountry",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getAddressWarehouseLogisticsCountryCountry()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "addressWarehouseLogisticsChooseOne",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00008")
      );
      exportOptions.addFieldMappingOption(
        "addressWarehouseLogisticsAddressType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00124")
      );
      exportOptions.addFieldMappingOption(
        "addressOrderProduct",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getAddressOrderProductName())
          )
      );
      exportOptions.addFieldMappingOption(
        "addressOrderProductClassify",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getAddressOrderProductClassifyName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "addressOrderMode",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00129")
      );
      exportOptions.addFieldMappingOption(
        "addressOrderStatus",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00006")
      );
      exportOptions.addFieldMappingOption(
        "addressOrderLogistics",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getAddressOrderLogisticsLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "addressOrderEndTime",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) -> DateUtils.toDateString((Date) o))
      );
      exportOptions.addFieldMappingOption(
        "addressOrderSpecial",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00009")
      );
      exportOptions.addFieldMappingOption(
        "addressActFill",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00130")
      );
      exportOptions.addFieldMappingOption(
        "addressActSelectQJ",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00131")
      );
      exportOptions.addFieldMappingOption(
        "processBaseSource",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00121")
      );
      exportOptions.addFieldMappingOption(
        "processBaseOrderPlatform",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00106")
      );
      exportOptions.addFieldMappingOption(
        "processBaseOrderSite",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getProcessBaseOrderSiteName())
          )
      );
      exportOptions.addFieldMappingOption(
        "processBaseOrderShopInfo",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getProcessBaseOrderShopInfoShopName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "processWarehouseLogisticsDeliveryWarehouse",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              (
                (OrderRuleItemVo) r
              ).getProcessWarehouseLogisticsDeliveryWarehouseName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "processWarehouseLogisticsProvider",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getProcessWarehouseLogisticsProviderLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "processWarehouseLogisticsChannel",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getProcessWarehouseLogisticsChannelLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "processWarehouseLogisticsCountry",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getProcessWarehouseLogisticsCountryCountry()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "processWarehouseLogisticsChooseOne",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00008")
      );
      exportOptions.addFieldMappingOption(
        "processWarehouseLogisticsprocessType",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00124")
      );
      exportOptions.addFieldMappingOption(
        "processOrderProduct",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getProcessOrderProductName())
          )
      );
      exportOptions.addFieldMappingOption(
        "processOrderProductClassify",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getProcessOrderProductClassifyName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "processOrderMode",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00129")
      );
      exportOptions.addFieldMappingOption(
        "processOrderStatus",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00006")
      );
      exportOptions.addFieldMappingOption(
        "processOrderLogistics",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getProcessOrderLogisticsLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "processOrderSpecial",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00009")
      );
      exportOptions.addFieldMappingOption(
        "processAct",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00132")
      );
      exportOptions.addFieldMappingOption(
        "issuBaseOrderPlatform",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00106")
      );
      exportOptions.addFieldMappingOption(
        "issuBaseOrderSite",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getIssuBaseOrderSiteName())
          )
      );
      exportOptions.addFieldMappingOption(
        "issuBaseOrderShopInfo",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getIssuBaseOrderShopInfoShopName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "issuWarehouseLogisticsDeliveryWarehouse",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              (
                (OrderRuleItemVo) r
              ).getIssuWarehouseLogisticsDeliveryWarehouseName()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "issuWarehouseLogisticsProvider",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getIssuWarehouseLogisticsProviderLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "issuWarehouseLogisticsChannel",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(
              ((OrderRuleItemVo) r).getIssuWarehouseLogisticsChannelLabel()
            )
          )
      );
      exportOptions.addFieldMappingOption(
        "issuOrderLogistics",
        new CustomExcelExport.FieldMappingOption()
          .setConverter((o, r) ->
            String.valueOf(((OrderRuleItemVo) r).getIssuOrderLogisticsLabel())
          )
      );
      exportOptions.addFieldMappingOption(
        "issuActRules",
        new CustomExcelExport.FieldMappingOption().setDictCode("SCM00133")
      );
      exportOptions.addStringFields(
        "name",
        "type",
        "status",
        "splitSplitMode",
        "splitBaseOrderOriginal",
        "splitBaseOrderType",
        "splitBaseOrderPlatform",
        "splitBaseOrderSiteName",
        "splitBaseOrderShopInfoShopName",
        "splitWarehouseLogisticsCountryCountry",
        "splitWarehouseLogisticsProvince",
        "splitWarehouseLogisticsCity",
        "splitWarehouseLogisticsPostCodeStart",
        "splitWarehouseLogisticsContains",
        "splitWarehouseLogisticsChooseOne",
        "splitWarehouseLogisticsWhite",
        "splitWarehouseLogisticsBlack",
        "splitWarehouseLogisticsAddressType",
        "splitOrderProductName",
        "splitOrderProductClassifyName",
        "splitOrderMode",
        "splitOrderTotal",
        "splitOrderSkuTotal",
        "splitOrderThinkWeight",
        "splitOrderThinkSize",
        "splitOrderTotalAmount",
        "splitOrderProductStatus",
        "splitOrderLogisticsLabel",
        "splitOrderEndTime",
        "splitOrderSpecial",
        "splitOrderGrossMargin",
        "splitAct",
        "splitActMode",
        "joinActSizeThreshold",
        "joinActWeightThreshold",
        "joinBaseOrderType",
        "joinBaseOrderPlatform",
        "joinBaseOrderSiteName",
        "joinBaseOrderShopInfoShopName",
        "joinWarehouseLogisticsAddressType",
        "joinOrderProductName",
        "joinOrderProductClassifyName",
        "joinOrderTotalAmount",
        "joinOrderMode",
        "joinOrderTotal",
        "joinOrderSkuTotal",
        "joinOrderThinkSize",
        "joinOrderThinkWeight",
        "joinOrderLogisticsLabel",
        "joinOrderSpecial",
        "joinOrderGrossMargin",
        "joinActMode",
        "warehouseBaseOrderPlatform",
        "warehouseBaseOrderSiteName",
        "warehouseBaseOrderShopInfoShopName",
        "warehouseWarehouseLogisticsCountryCountry",
        "warehouseWarehouseLogisticsProvince",
        "warehouseWarehouseLogisticsCity",
        "warehouseWarehouseLogisticsPostCodeStart",
        "warehouseWarehouseLogisticsContains",
        "warehouseWarehouseLogisticsChooseOne",
        "warehouseWarehouseLogisticsWhite",
        "warehouseWarehouseLogisticsBlack",
        "warehouseWarehouseLogisticsAddressType",
        "warehouseOrderMsku",
        "warehouseOrderProductName",
        "warehouseOrderProductClassifyName",
        "warehouseOrderLogisticsLabel",
        "warehouseOrderSpecial",
        "warehouseOrderGrossMargin",
        "warehouseActDeliveryWarehouseName",
        "warehouseActOptionWarehouseName",
        "warehouseActAutoCoverOriginal",
        "warehouseActInventoryDeductionType",
        "logisticsBaseOrderPlatform",
        "logisticsBaseOrderSiteName",
        "logisticsBaseOrderShopInfoShopName",
        "logisticsWarehouseLogisticsCountryCountry",
        "logisticsWarehouseLogisticsProvince",
        "logisticsWarehouseLogisticsCity",
        "logisticsWarehouseLogisticsPostCodeStart",
        "logisticsWarehouseLogisticsContains",
        "logisticsWarehouseLogisticsChooseOne",
        "logisticsWarehouseLogisticsWhite",
        "logisticsWarehouseLogisticsBlack",
        "logisticsWarehouseLogisticsAddressType",
        "logisticsOrderMsku",
        "logisticsOrderProductName",
        "logisticsOrderProductClassifyName",
        "logisticsOrderThinkSize",
        "logisticsOrderThinkWeight",
        "logisticsOrderTotalAmount",
        "logisticsOrderLogisticsLabel",
        "logisticsOrderFreight",
        "logisticsOrderSpecial",
        "logisticsOrderGrossMargin",
        "logisticsActSettingMethod",
        "logisticsActChannelLabel",
        "logisticsActOverseasWarehouseAutoMapping",
        "logisticsActAutoCoverOriginal",
        "logisticsActPriceParity",
        "logisticsActProviderLabel",
        "addressBaseSource",
        "addressBaseOrderPlatform",
        "addressBaseOrderSiteName",
        "addressBaseOrderShopInfoShopName",
        "addressWarehouseLogisticsDeliveryWarehouseName",
        "addressWarehouseLogisticsProviderLabel",
        "addressWarehouseLogisticsChannelLabel",
        "addressWarehouseLogisticsCountryCountry",
        "addressWarehouseLogisticsProvince",
        "addressWarehouseLogisticsCity",
        "addressWarehouseLogisticsPostCodeStart",
        "addressWarehouseLogisticsContains",
        "addressWarehouseLogisticsChooseOne",
        "addressWarehouseLogisticsBlack",
        "addressWarehouseLogisticsAddressType",
        "addressOrderProductName",
        "addressOrderProductClassifyName",
        "addressOrderMode",
        "addressOrderTotal",
        "addressOrderSkuTotal",
        "addressOrderThinkWeight",
        "addressOrderThinkSize",
        "addressOrderTotalAmount",
        "addressOrderStatus",
        "addressOrderLogisticsLabel",
        "addressOrderSpecial",
        "addressOrderGrossMargin",
        "addressActFill",
        "addressActSelectQJ",
        "addressActHouseNoAnalysis1",
        "addressActHouseNoAnalysis2",
        "addressActHouseNoAnalysis3",
        "addressActPhoneSimplify1",
        "addressActPhoneSimplify2",
        "addressActPhoneSimplify3",
        "addressActPhoneSimplify4",
        "addressActPostHandle1",
        "addressActPostHandle2",
        "processBaseSource",
        "processBaseOrderPlatform",
        "processBaseOrderSiteName",
        "processBaseOrderShopInfoShopName",
        "processWarehouseLogisticsDeliveryWarehouseName",
        "processWarehouseLogisticsProviderLabel",
        "processWarehouseLogisticsChannelLabel",
        "processWarehouseLogisticsCountryCountry",
        "processWarehouseLogisticsProvince",
        "processWarehouseLogisticsCity",
        "processWarehouseLogisticsPostCodeStart",
        "processWarehouseLogisticsContains",
        "processWarehouseLogisticsChooseOne",
        "processWarehouseLogisticsBlack",
        "processWarehouseLogisticsprocessType",
        "processOrderProductName",
        "processOrderProductClassifyName",
        "processOrderMode",
        "processOrderTotal",
        "processOrderSkuTotal",
        "processOrderThinkWeight",
        "processOrderThinkSize",
        "processOrderTotalAmount",
        "processOrderStatus",
        "processOrderLogisticsLabel",
        "processOrderEndTime",
        "processOrderSpecial",
        "processOrderGrossMargin",
        "processAct",
        "issuBaseOrderPlatform",
        "issuBaseOrderSiteName",
        "issuBaseOrderShopInfoShopName",
        "issuWarehouseLogisticsDeliveryWarehouseName",
        "issuWarehouseLogisticsProviderLabel",
        "issuWarehouseLogisticsChannelLabel",
        "issuOrderLogisticsLabel",
        "issuOrderGrossMargin",
        "issuActRules"
      );

      String fileName = String.format(
        "订单规则(%s).xlsx",
        DateUtils.toString(null, DateUtils.PATTERN_DATE_TIME)
      );
      ResponseUtils.setAttachmentFileName(response, fileName);
      customExcelExport.run(exportOptions, response.getOutputStream());
      return;
    }
    List<SysDictAllItem> typeItems = sysDictService.getDictItems("SCM10117");
    List<SysDictAllItem> statusItems = sysDictService.getDictItems("SCM00134");
    List<SysDictAllItem> splitSplitModeItems = sysDictService.getDictItems(
      "SCM00118"
    );
    List<SysDictAllItem> splitBaseOrderOriginalItems =
      sysDictService.getDictItems("SCM00121");
    List<SysDictAllItem> splitBaseOrderTypeItems = sysDictService.getDictItems(
      "SCM00122"
    );
    List<SysDictAllItem> splitBaseOrderPlatformItems =
      sysDictService.getDictItems("SCM00106");
    List<SysDictAllItem> splitWarehouseLogisticsChooseOneItems =
      sysDictService.getDictItems("SCM00008");
    List<SysDictAllItem> splitWarehouseLogisticsAddressTypeItems =
      sysDictService.getDictItems("SCM00124");
    List<SysDictAllItem> splitOrderModeItems = sysDictService.getDictItems(
      "SCM00129"
    );
    List<SysDictAllItem> splitOrderProductStatusItems =
      sysDictService.getDictItems("SCM00006");
    List<SysDictAllItem> splitOrderSpecialItems = sysDictService.getDictItems(
      "SCM00009"
    );
    List<SysDictAllItem> splitActItems = sysDictService.getDictItems(
      "SCM00128"
    );
    List<SysDictAllItem> splitActModeItems = sysDictService.getDictItems(
      "SCM00126"
    );
    List<SysDictAllItem> joinBaseOrderTypeItems = sysDictService.getDictItems(
      "SCM00122"
    );
    List<SysDictAllItem> joinBaseOrderPlatformItems =
      sysDictService.getDictItems("SCM00106");
    List<SysDictAllItem> joinWarehouseLogisticsAddressTypeItems =
      sysDictService.getDictItems("SCM00124");
    List<SysDictAllItem> joinOrderModeItems = sysDictService.getDictItems(
      "SCM00129"
    );
    List<SysDictAllItem> joinOrderSpecialItems = sysDictService.getDictItems(
      "SCM00009"
    );
    List<SysDictAllItem> joinActModeItems = sysDictService.getDictItems(
      "SCM00125"
    );
    List<SysDictAllItem> warehouseBaseOrderPlatformItems =
      sysDictService.getDictItems("SCM00106");
    List<SysDictAllItem> warehouseWarehouseLogisticsChooseOneItems =
      sysDictService.getDictItems("SCM00008");
    List<SysDictAllItem> warehouseWarehouseLogisticsAddressTypeItems =
      sysDictService.getDictItems("SCM00124");
    List<SysDictAllItem> warehouseOrderSpecialItems =
      sysDictService.getDictItems("SCM00009");
    List<SysDictAllItem> warehouseActAutoCoverOriginalItems =
      sysDictService.getDictItems("SCM00008");
    List<SysDictAllItem> warehouseActInventoryDeductionTypeItems =
      sysDictService.getDictItems("SCM00127");
    List<SysDictAllItem> logisticsBaseOrderPlatformItems =
      sysDictService.getDictItems("SCM00106");
    List<SysDictAllItem> logisticsWarehouseLogisticsChooseOneItems =
      sysDictService.getDictItems("SCM00008");
    List<SysDictAllItem> logisticsWarehouseLogisticsAddressTypeItems =
      sysDictService.getDictItems("SCM00124");
    List<SysDictAllItem> logisticsOrderSpecialItems =
      sysDictService.getDictItems("SCM00009");
    List<SysDictAllItem> logisticsActSettingMethodItems =
      sysDictService.getDictItems("SCM00119");
    List<SysDictAllItem> logisticsActOverseasWarehouseAutoMappingItems =
      sysDictService.getDictItems("SCM00008");
    List<SysDictAllItem> logisticsActAutoCoverOriginalItems =
      sysDictService.getDictItems("SCM00008");
    List<SysDictAllItem> logisticsActPriceParityItems =
      sysDictService.getDictItems("SCM00120");
    List<SysDictAllItem> addressBaseSourceItems = sysDictService.getDictItems(
      "SCM00121"
    );
    List<SysDictAllItem> addressBaseOrderPlatformItems =
      sysDictService.getDictItems("SCM00106");
    List<SysDictAllItem> addressWarehouseLogisticsChooseOneItems =
      sysDictService.getDictItems("SCM00008");
    List<SysDictAllItem> addressWarehouseLogisticsAddressTypeItems =
      sysDictService.getDictItems("SCM00124");
    List<SysDictAllItem> addressOrderModeItems = sysDictService.getDictItems(
      "SCM00129"
    );
    List<SysDictAllItem> addressOrderStatusItems = sysDictService.getDictItems(
      "SCM00006"
    );
    List<SysDictAllItem> addressOrderSpecialItems = sysDictService.getDictItems(
      "SCM00009"
    );
    List<SysDictAllItem> addressActFillItems = sysDictService.getDictItems(
      "SCM00130"
    );
    List<SysDictAllItem> addressActSelectQJItems = sysDictService.getDictItems(
      "SCM00131"
    );
    List<SysDictAllItem> processBaseSourceItems = sysDictService.getDictItems(
      "SCM00121"
    );
    List<SysDictAllItem> processBaseOrderPlatformItems =
      sysDictService.getDictItems("SCM00106");
    List<SysDictAllItem> processWarehouseLogisticsChooseOneItems =
      sysDictService.getDictItems("SCM00008");
    List<SysDictAllItem> processWarehouseLogisticsprocessTypeItems =
      sysDictService.getDictItems("SCM00124");
    List<SysDictAllItem> processOrderModeItems = sysDictService.getDictItems(
      "SCM00129"
    );
    List<SysDictAllItem> processOrderStatusItems = sysDictService.getDictItems(
      "SCM00006"
    );
    List<SysDictAllItem> processOrderSpecialItems = sysDictService.getDictItems(
      "SCM00009"
    );
    List<SysDictAllItem> processActItems = sysDictService.getDictItems(
      "SCM00132"
    );
    List<SysDictAllItem> issuBaseOrderPlatformItems =
      sysDictService.getDictItems("SCM00106");
    List<SysDictAllItem> issuActRulesItems = sysDictService.getDictItems(
      "SCM00133"
    );
    search.setPageSize(EXPORT_QUERY_MAX_SIZE);
    int current = 1;
    List<OrderRuleExcelPo> items = new ArrayList<OrderRuleExcelPo>();
    while (true) {
      search.setCurrent(current);
      Page<OrderRuleItemVo> page = this.pageSearch(search);
      if (page.getTotal() > EXPORT_MAX_SIZE) {
        throw new RException("导出记录数超出限制！");
      }
      List<OrderRuleItemVo> list = page.getRecords();
      if (list.isEmpty()) {
        break;
      }
      for (OrderRuleItemVo item : list) {
        OrderRuleExcelPo excel = new OrderRuleExcelPo();
        BeanUtils.copyProperties(item, excel);
        if (item.getType() != null) {
          typeItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getType()))
            .findFirst()
            .ifPresent(i -> excel.setType(i.getItemText()));
        }
        if (item.getStatus() != null) {
          statusItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getStatus()))
            .findFirst()
            .ifPresent(i -> excel.setStatus(i.getItemText()));
        }
        if (item.getSplitSplitMode() != null) {
          splitSplitModeItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getSplitSplitMode()))
            .findFirst()
            .ifPresent(i -> excel.setSplitSplitMode(i.getItemText()));
        }
        if (item.getSplitBaseOrderOriginal() != null) {
          final List<String> SplitBaseOrderOriginalValues = Arrays
            .stream(item.getSplitBaseOrderOriginal().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setSplitBaseOrderOriginal(
            splitBaseOrderOriginalItems
              .stream()
              .filter(i ->
                SplitBaseOrderOriginalValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getSplitBaseOrderType() != null) {
          final List<String> SplitBaseOrderTypeValues = Arrays
            .stream(item.getSplitBaseOrderType().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setSplitBaseOrderType(
            splitBaseOrderTypeItems
              .stream()
              .filter(i -> SplitBaseOrderTypeValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getSplitBaseOrderPlatform() != null) {
          final List<String> SplitBaseOrderPlatformValues = Arrays
            .stream(item.getSplitBaseOrderPlatform().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setSplitBaseOrderPlatform(
            splitBaseOrderPlatformItems
              .stream()
              .filter(i ->
                SplitBaseOrderPlatformValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getSplitWarehouseLogisticsChooseOne() != null) {
          splitWarehouseLogisticsChooseOneItems
            .stream()
            .filter(i ->
              i
                .getItemValue()
                .equals(item.getSplitWarehouseLogisticsChooseOne())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setSplitWarehouseLogisticsChooseOne(i.getItemText())
            );
        }
        if (item.getSplitWarehouseLogisticsAddressType() != null) {
          final List<String> SplitWarehouseLogisticsAddressTypeValues = Arrays
            .stream(item.getSplitWarehouseLogisticsAddressType().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setSplitWarehouseLogisticsAddressType(
            splitWarehouseLogisticsAddressTypeItems
              .stream()
              .filter(i ->
                SplitWarehouseLogisticsAddressTypeValues.contains(
                  i.getItemValue()
                )
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getSplitOrderMode() != null) {
          splitOrderModeItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getSplitOrderMode()))
            .findFirst()
            .ifPresent(i -> excel.setSplitOrderMode(i.getItemText()));
        }
        if (item.getSplitOrderProductStatus() != null) {
          final List<String> SplitOrderProductStatusValues = Arrays
            .stream(item.getSplitOrderProductStatus().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setSplitOrderProductStatus(
            splitOrderProductStatusItems
              .stream()
              .filter(i ->
                SplitOrderProductStatusValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getSplitOrderSpecial() != null) {
          final List<String> SplitOrderSpecialValues = Arrays
            .stream(item.getSplitOrderSpecial().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setSplitOrderSpecial(
            splitOrderSpecialItems
              .stream()
              .filter(i -> SplitOrderSpecialValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getSplitAct() != null) {
          splitActItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getSplitAct()))
            .findFirst()
            .ifPresent(i -> excel.setSplitAct(i.getItemText()));
        }
        if (item.getSplitActMode() != null) {
          splitActModeItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getSplitActMode()))
            .findFirst()
            .ifPresent(i -> excel.setSplitActMode(i.getItemText()));
        }
        if (item.getJoinBaseOrderType() != null) {
          final List<String> JoinBaseOrderTypeValues = Arrays
            .stream(item.getJoinBaseOrderType().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setJoinBaseOrderType(
            joinBaseOrderTypeItems
              .stream()
              .filter(i -> JoinBaseOrderTypeValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getJoinBaseOrderPlatform() != null) {
          final List<String> JoinBaseOrderPlatformValues = Arrays
            .stream(item.getJoinBaseOrderPlatform().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setJoinBaseOrderPlatform(
            joinBaseOrderPlatformItems
              .stream()
              .filter(i ->
                JoinBaseOrderPlatformValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getJoinWarehouseLogisticsAddressType() != null) {
          final List<String> JoinWarehouseLogisticsAddressTypeValues = Arrays
            .stream(item.getJoinWarehouseLogisticsAddressType().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setJoinWarehouseLogisticsAddressType(
            joinWarehouseLogisticsAddressTypeItems
              .stream()
              .filter(i ->
                JoinWarehouseLogisticsAddressTypeValues.contains(
                  i.getItemValue()
                )
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getJoinOrderMode() != null) {
          joinOrderModeItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getJoinOrderMode()))
            .findFirst()
            .ifPresent(i -> excel.setJoinOrderMode(i.getItemText()));
        }
        if (item.getJoinOrderSpecial() != null) {
          joinOrderSpecialItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getJoinOrderSpecial()))
            .findFirst()
            .ifPresent(i -> excel.setJoinOrderSpecial(i.getItemText()));
        }
        if (item.getJoinActMode() != null) {
          joinActModeItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getJoinActMode()))
            .findFirst()
            .ifPresent(i -> excel.setJoinActMode(i.getItemText()));
        }
        if (item.getWarehouseBaseOrderPlatform() != null) {
          final List<String> WarehouseBaseOrderPlatformValues = Arrays
            .stream(item.getWarehouseBaseOrderPlatform().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setWarehouseBaseOrderPlatform(
            warehouseBaseOrderPlatformItems
              .stream()
              .filter(i ->
                WarehouseBaseOrderPlatformValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getWarehouseWarehouseLogisticsChooseOne() != null) {
          warehouseWarehouseLogisticsChooseOneItems
            .stream()
            .filter(i ->
              i
                .getItemValue()
                .equals(item.getWarehouseWarehouseLogisticsChooseOne())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setWarehouseWarehouseLogisticsChooseOne(i.getItemText())
            );
        }
        if (item.getWarehouseWarehouseLogisticsAddressType() != null) {
          final List<String> WarehouseWarehouseLogisticsAddressTypeValues =
            Arrays
              .stream(
                item.getWarehouseWarehouseLogisticsAddressType().split(",")
              )
              .filter(StringUtils::hasText)
              .collect(Collectors.toList());
          excel.setWarehouseWarehouseLogisticsAddressType(
            warehouseWarehouseLogisticsAddressTypeItems
              .stream()
              .filter(i ->
                WarehouseWarehouseLogisticsAddressTypeValues.contains(
                  i.getItemValue()
                )
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getWarehouseOrderSpecial() != null) {
          final List<String> WarehouseOrderSpecialValues = Arrays
            .stream(item.getWarehouseOrderSpecial().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setWarehouseOrderSpecial(
            warehouseOrderSpecialItems
              .stream()
              .filter(i ->
                WarehouseOrderSpecialValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getWarehouseActAutoCoverOriginal() != null) {
          warehouseActAutoCoverOriginalItems
            .stream()
            .filter(i ->
              i.getItemValue().equals(item.getWarehouseActAutoCoverOriginal())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setWarehouseActAutoCoverOriginal(i.getItemText())
            );
        }
        if (item.getWarehouseActInventoryDeductionType() != null) {
          warehouseActInventoryDeductionTypeItems
            .stream()
            .filter(i ->
              i
                .getItemValue()
                .equals(item.getWarehouseActInventoryDeductionType())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setWarehouseActInventoryDeductionType(i.getItemText())
            );
        }
        if (item.getLogisticsBaseOrderPlatform() != null) {
          final List<String> LogisticsBaseOrderPlatformValues = Arrays
            .stream(item.getLogisticsBaseOrderPlatform().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setLogisticsBaseOrderPlatform(
            logisticsBaseOrderPlatformItems
              .stream()
              .filter(i ->
                LogisticsBaseOrderPlatformValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getLogisticsWarehouseLogisticsChooseOne() != null) {
          logisticsWarehouseLogisticsChooseOneItems
            .stream()
            .filter(i ->
              i
                .getItemValue()
                .equals(item.getLogisticsWarehouseLogisticsChooseOne())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setLogisticsWarehouseLogisticsChooseOne(i.getItemText())
            );
        }
        if (item.getLogisticsWarehouseLogisticsAddressType() != null) {
          final List<String> LogisticsWarehouseLogisticsAddressTypeValues =
            Arrays
              .stream(
                item.getLogisticsWarehouseLogisticsAddressType().split(",")
              )
              .filter(StringUtils::hasText)
              .collect(Collectors.toList());
          excel.setLogisticsWarehouseLogisticsAddressType(
            logisticsWarehouseLogisticsAddressTypeItems
              .stream()
              .filter(i ->
                LogisticsWarehouseLogisticsAddressTypeValues.contains(
                  i.getItemValue()
                )
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getLogisticsOrderSpecial() != null) {
          final List<String> LogisticsOrderSpecialValues = Arrays
            .stream(item.getLogisticsOrderSpecial().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setLogisticsOrderSpecial(
            logisticsOrderSpecialItems
              .stream()
              .filter(i ->
                LogisticsOrderSpecialValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getLogisticsActSettingMethod() != null) {
          logisticsActSettingMethodItems
            .stream()
            .filter(i ->
              i.getItemValue().equals(item.getLogisticsActSettingMethod())
            )
            .findFirst()
            .ifPresent(i -> excel.setLogisticsActSettingMethod(i.getItemText())
            );
        }
        if (item.getLogisticsActOverseasWarehouseAutoMapping() != null) {
          logisticsActOverseasWarehouseAutoMappingItems
            .stream()
            .filter(i ->
              i
                .getItemValue()
                .equals(item.getLogisticsActOverseasWarehouseAutoMapping())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setLogisticsActOverseasWarehouseAutoMapping(i.getItemText())
            );
        }
        if (item.getLogisticsActAutoCoverOriginal() != null) {
          logisticsActAutoCoverOriginalItems
            .stream()
            .filter(i ->
              i.getItemValue().equals(item.getLogisticsActAutoCoverOriginal())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setLogisticsActAutoCoverOriginal(i.getItemText())
            );
        }
        if (item.getLogisticsActPriceParity() != null) {
          final List<String> LogisticsActPriceParityValues = Arrays
            .stream(item.getLogisticsActPriceParity().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setLogisticsActPriceParity(
            logisticsActPriceParityItems
              .stream()
              .filter(i ->
                LogisticsActPriceParityValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getAddressBaseSource() != null) {
          final List<String> AddressBaseSourceValues = Arrays
            .stream(item.getAddressBaseSource().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setAddressBaseSource(
            addressBaseSourceItems
              .stream()
              .filter(i -> AddressBaseSourceValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getAddressBaseOrderPlatform() != null) {
          final List<String> AddressBaseOrderPlatformValues = Arrays
            .stream(item.getAddressBaseOrderPlatform().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setAddressBaseOrderPlatform(
            addressBaseOrderPlatformItems
              .stream()
              .filter(i ->
                AddressBaseOrderPlatformValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getAddressWarehouseLogisticsChooseOne() != null) {
          addressWarehouseLogisticsChooseOneItems
            .stream()
            .filter(i ->
              i
                .getItemValue()
                .equals(item.getAddressWarehouseLogisticsChooseOne())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setAddressWarehouseLogisticsChooseOne(i.getItemText())
            );
        }
        if (item.getAddressWarehouseLogisticsAddressType() != null) {
          final List<String> AddressWarehouseLogisticsAddressTypeValues = Arrays
            .stream(item.getAddressWarehouseLogisticsAddressType().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setAddressWarehouseLogisticsAddressType(
            addressWarehouseLogisticsAddressTypeItems
              .stream()
              .filter(i ->
                AddressWarehouseLogisticsAddressTypeValues.contains(
                  i.getItemValue()
                )
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getAddressOrderMode() != null) {
          addressOrderModeItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getAddressOrderMode()))
            .findFirst()
            .ifPresent(i -> excel.setAddressOrderMode(i.getItemText()));
        }
        if (item.getAddressOrderStatus() != null) {
          final List<String> AddressOrderStatusValues = Arrays
            .stream(item.getAddressOrderStatus().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setAddressOrderStatus(
            addressOrderStatusItems
              .stream()
              .filter(i -> AddressOrderStatusValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getAddressOrderSpecial() != null) {
          final List<String> AddressOrderSpecialValues = Arrays
            .stream(item.getAddressOrderSpecial().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setAddressOrderSpecial(
            addressOrderSpecialItems
              .stream()
              .filter(i -> AddressOrderSpecialValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getAddressActFill() != null) {
          final List<String> AddressActFillValues = Arrays
            .stream(item.getAddressActFill().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setAddressActFill(
            addressActFillItems
              .stream()
              .filter(i -> AddressActFillValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getAddressActSelectQJ() != null) {
          final List<String> AddressActSelectQJValues = Arrays
            .stream(item.getAddressActSelectQJ().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setAddressActSelectQJ(
            addressActSelectQJItems
              .stream()
              .filter(i -> AddressActSelectQJValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getProcessBaseSource() != null) {
          final List<String> ProcessBaseSourceValues = Arrays
            .stream(item.getProcessBaseSource().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setProcessBaseSource(
            processBaseSourceItems
              .stream()
              .filter(i -> ProcessBaseSourceValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getProcessBaseOrderPlatform() != null) {
          final List<String> ProcessBaseOrderPlatformValues = Arrays
            .stream(item.getProcessBaseOrderPlatform().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setProcessBaseOrderPlatform(
            processBaseOrderPlatformItems
              .stream()
              .filter(i ->
                ProcessBaseOrderPlatformValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getProcessWarehouseLogisticsChooseOne() != null) {
          processWarehouseLogisticsChooseOneItems
            .stream()
            .filter(i ->
              i
                .getItemValue()
                .equals(item.getProcessWarehouseLogisticsChooseOne())
            )
            .findFirst()
            .ifPresent(i ->
              excel.setProcessWarehouseLogisticsChooseOne(i.getItemText())
            );
        }
        if (item.getProcessWarehouseLogisticsprocessType() != null) {
          final List<String> ProcessWarehouseLogisticsprocessTypeValues = Arrays
            .stream(item.getProcessWarehouseLogisticsprocessType().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setProcessWarehouseLogisticsprocessType(
            processWarehouseLogisticsprocessTypeItems
              .stream()
              .filter(i ->
                ProcessWarehouseLogisticsprocessTypeValues.contains(
                  i.getItemValue()
                )
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getProcessOrderMode() != null) {
          processOrderModeItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getProcessOrderMode()))
            .findFirst()
            .ifPresent(i -> excel.setProcessOrderMode(i.getItemText()));
        }
        if (item.getProcessOrderStatus() != null) {
          final List<String> ProcessOrderStatusValues = Arrays
            .stream(item.getProcessOrderStatus().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setProcessOrderStatus(
            processOrderStatusItems
              .stream()
              .filter(i -> ProcessOrderStatusValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getProcessOrderSpecial() != null) {
          final List<String> ProcessOrderSpecialValues = Arrays
            .stream(item.getProcessOrderSpecial().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setProcessOrderSpecial(
            processOrderSpecialItems
              .stream()
              .filter(i -> ProcessOrderSpecialValues.contains(i.getItemValue()))
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getProcessAct() != null) {
          processActItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getProcessAct()))
            .findFirst()
            .ifPresent(i -> excel.setProcessAct(i.getItemText()));
        }
        if (item.getIssuBaseOrderPlatform() != null) {
          final List<String> IssuBaseOrderPlatformValues = Arrays
            .stream(item.getIssuBaseOrderPlatform().split(","))
            .filter(StringUtils::hasText)
            .collect(Collectors.toList());
          excel.setIssuBaseOrderPlatform(
            issuBaseOrderPlatformItems
              .stream()
              .filter(i ->
                IssuBaseOrderPlatformValues.contains(i.getItemValue())
              )
              .map(SysDictAllItem::getItemText)
              .collect(Collectors.joining(","))
          );
        }
        if (item.getIssuActRules() != null) {
          issuActRulesItems
            .stream()
            .filter(i -> i.getItemValue().equals(item.getIssuActRules()))
            .findFirst()
            .ifPresent(i -> excel.setIssuActRules(i.getItemText()));
        }

        items.add(excel);
      }
      if (list.size() < EXPORT_QUERY_MAX_SIZE) {
        break;
      }
      current++;
    }

    String fileName = String.format(
      "订单规则(%s).xlsx",
      DateUtils.toString(null, DateUtils.PATTERN_DATE_TIME)
    );
    ResponseUtils.setAttachmentFileName(response, fileName);
    EasyExcel
      .write(response.getOutputStream())
      .registerWriteHandler(new CustomExcelHandler())
      .sheet()
      .head(OrderRuleExcelPo.class)
      .doWrite(items);
  }

  /**
   * 通过规则名称查询订单规则主键(重复时返回最新的主键)
   */
  @Override
  public Long getIdByName(String name) {
    return this.baseMapper.getIdByName(name);
  }

  /**
   * 通过规则名称查询订单规则多主键(重复时返回最新的主键)
   */
  @Override
  public List<Long> getIdsByName(List<String> list) {
    return this.baseMapper.getIdsByName(list);
  }

  /**
   * 通过订单规则主键查询规则名称
   */
  @Override
  public String getNameById(Long id) {
    return this.baseMapper.getNameById(id);
  }

  /**
   * 通过订单规则主键查询规则名称列表
   */
  @Override
  public List<String> getNameByIds(List<Long> ids) {
    List<Map<String, Object>> maps = this.baseMapper.getNameByIds(ids);
    // 将返回重新排列为输入相同顺序
    return ids
      .stream()
      .map(id -> {
        Optional<Map<String, Object>> optionalMap = maps
          .stream()
          .filter(map -> id.equals(map.get("id")))
          .findFirst();
        return optionalMap
          .map(stringObjectMap -> (String) stringObjectMap.get("name"))
          .orElse(null);
      })
      .collect(Collectors.toList());
  }

  /**
   * 获取详情
   * @param id 订单规则的主键
   */
  @DataActivity(action = SysDataActivityAction.View)
  @Override
  public OrderRuleVo getVoById(Long id) throws Exception {
    OrderRuleVo vo = this.baseMapper.selectVoById(id);
    if (vo == null) {
      return null;
    }
    return vo;
  }

  /**
   * 分页查询订单规则
   * @param search 查询条件
   * @return 订单规则分页查询结果
   */
  @Override
  public Page<OrderRuleItemVo> pageSearch(OrderRuleSearchParamPo search) {
    Page<OrderRuleItemVo> page = new Page<>();
    if (
      Objects.nonNull(search.getWfStatus()) &&
      StringUtils.hasText(search.getFormName())
    ) {
      List<WorkFlow> workFlowList = workFlowService.queryWfListByStatus(
        search.getWfStatus(),
        search.getFormName()
      );
      if (CollectionUtils.isEmpty(workFlowList)) {
        return page;
      }
      List<Long> ids = workFlowList
        .stream()
        .map(WorkFlow::getRecordId)
        .collect(Collectors.toList());
      if (CollectionUtils.isEmpty(ids)) {
        return page;
      }
      search.setSelectedIds(ids);
    }
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    page = this.baseMapper.pageSearch(search.toPage(), search);
    List<Long> recordIds = page
      .getRecords()
      .stream()
      .map(OrderRuleItemVo::getId)
      .collect(Collectors.toList());
    if (CollectionUtils.isEmpty(recordIds)) {
      return page;
    }
    List<WorkFlow> workFlows = workFlowService.queryWfList(
      recordIds,
      Collections.singletonList(search.getFormName())
    );
    if (CollectionUtils.isEmpty(workFlows)) {
      return page;
    }
    Map<Long, Integer> flowMap = workFlows
      .stream()
      .collect(Collectors.toMap(WorkFlow::getRecordId, WorkFlow::getWfStatus));
    page
      .getRecords()
      .stream()
      .forEach(item -> {
        if (!flowMap.containsKey(item.getId())) {
          return;
        }
        item.setWfStatus(flowMap.get(item.getId()));
      });
    return page;
  }

  /**
   * 订单规则快速查询选项(有缓存)
   * @param search 查询条件
   * @return 选项结果
   */
  @Override
  @Cacheable(
    value = CacheConfig.FAST,
    key = "'OrderRuleOptions::' + @userInfo.userTypeAndId + '::' + #search.keyword"
  )
  public List<OptionItem<OrderRuleItemVo>> searchOptions(
    OrderRuleSearchParamPo search
  ) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.searchOptions(search);
  }

  /**
   * 列表查询订单规则
   * @param search 查询条件
   * @return 订单规则列表查询结果
   */
  @Override
  public List<OrderRuleItemVo> search(OrderRuleSearchParamPo search) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.search(search);
  }

  /**
   * 查询订单规则最后更新时间
   * @param search 查询条件
   * @return 订单规则最后更新时间
   */
  @Override
  public Date searchLastUpdateTime(OrderRuleSearchParamPo search) {
    return this.baseMapper.searchLastUpdateTime(search);
  }

  /**
   * 启用
   */
  @DataActivity(
    action = SysDataActivityAction.Other,
    message = "%s执行了启用操作"
  )
  @Override
  public void enable(List<Long> ids) throws Exception {
    if (orderRuleEnableAction == null) {
      throw new Exception("此操作当前不可用");
    }
    orderRuleEnableAction.run(ids);
  }

  /**
   * 禁用
   */
  @DataActivity(
    action = SysDataActivityAction.Other,
    message = "%s执行了禁用操作"
  )
  @Override
  public void disable(List<Long> ids) throws Exception {
    if (orderRuleDisableAction == null) {
      throw new Exception("此操作当前不可用");
    }
    orderRuleDisableAction.run(ids);
  }

  /**
   * 拆分订单
   */
  @Override
  public List<OrderRuleItemVo> split(OrderRuleSearchParamPo search) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.split(search);
  }

  /**
   * 拆分订单分页
   */
  @Override
  public Page<OrderRuleItemVo> splitPage(OrderRuleSearchParamPo search) {
    Page<OrderRuleItemVo> splitPage = new Page<>();
    if (
      Objects.nonNull(search.getWfStatus()) &&
      StringUtils.hasText(search.getFormName())
    ) {
      List<WorkFlow> workFlowList = workFlowService.queryWfListByStatus(
        search.getWfStatus(),
        search.getFormName()
      );
      if (CollectionUtils.isEmpty(workFlowList)) {
        return splitPage;
      }
      List<Long> ids = workFlowList
        .stream()
        .map(WorkFlow::getRecordId)
        .collect(Collectors.toList());
      if (CollectionUtils.isEmpty(ids)) {
        return splitPage;
      }
      search.setSelectedIds(ids);
    }
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    splitPage = this.baseMapper.splitPage(search.toPage(), search);
    List<Long> recordIds = splitPage
      .getRecords()
      .stream()
      .map(OrderRuleItemVo::getId)
      .collect(Collectors.toList());
    if (CollectionUtils.isEmpty(recordIds)) {
      return splitPage;
    }
    List<WorkFlow> workFlows = workFlowService.queryWfList(
      recordIds,
      Collections.singletonList(search.getFormName())
    );
    if (CollectionUtils.isEmpty(workFlows)) {
      return splitPage;
    }
    Map<Long, Integer> flowMap = workFlows
      .stream()
      .collect(Collectors.toMap(WorkFlow::getRecordId, WorkFlow::getWfStatus));
    splitPage
      .getRecords()
      .stream()
      .forEach(item -> {
        if (!flowMap.containsKey(item.getId())) {
          return;
        }
        item.setWfStatus(flowMap.get(item.getId()));
      });

    return splitPage;
  }

  /**
   * 查询拆分订单最后更新时间
   * @param search 查询条件
   * @return 拆分订单最后更新时间
   */
  @Override
  public Date splitLastUpdateTime(OrderRuleSearchParamPo search) {
    return this.baseMapper.splitLastUpdateTime(search);
  }

  /**
   * 合并订单
   */
  @Override
  public List<OrderRuleItemVo> join(OrderRuleSearchParamPo search) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.join(search);
  }

  /**
   * 合并订单分页
   */
  @Override
  public Page<OrderRuleItemVo> joinPage(OrderRuleSearchParamPo search) {
    Page<OrderRuleItemVo> joinPage = new Page<>();
    if (
      Objects.nonNull(search.getWfStatus()) &&
      StringUtils.hasText(search.getFormName())
    ) {
      List<WorkFlow> workFlowList = workFlowService.queryWfListByStatus(
        search.getWfStatus(),
        search.getFormName()
      );
      if (CollectionUtils.isEmpty(workFlowList)) {
        return joinPage;
      }
      List<Long> ids = workFlowList
        .stream()
        .map(WorkFlow::getRecordId)
        .collect(Collectors.toList());
      if (CollectionUtils.isEmpty(ids)) {
        return joinPage;
      }
      search.setSelectedIds(ids);
    }
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    joinPage = this.baseMapper.joinPage(search.toPage(), search);
    List<Long> recordIds = joinPage
      .getRecords()
      .stream()
      .map(OrderRuleItemVo::getId)
      .collect(Collectors.toList());
    if (CollectionUtils.isEmpty(recordIds)) {
      return joinPage;
    }
    List<WorkFlow> workFlows = workFlowService.queryWfList(
      recordIds,
      Collections.singletonList(search.getFormName())
    );
    if (CollectionUtils.isEmpty(workFlows)) {
      return joinPage;
    }
    Map<Long, Integer> flowMap = workFlows
      .stream()
      .collect(Collectors.toMap(WorkFlow::getRecordId, WorkFlow::getWfStatus));
    joinPage
      .getRecords()
      .stream()
      .forEach(item -> {
        if (!flowMap.containsKey(item.getId())) {
          return;
        }
        item.setWfStatus(flowMap.get(item.getId()));
      });

    return joinPage;
  }

  /**
   * 查询合并订单最后更新时间
   * @param search 查询条件
   * @return 合并订单最后更新时间
   */
  @Override
  public Date joinLastUpdateTime(OrderRuleSearchParamPo search) {
    return this.baseMapper.joinLastUpdateTime(search);
  }

  /**
   * 设定仓库
   */
  @Override
  public List<OrderRuleItemVo> warehouse(OrderRuleSearchParamPo search) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.warehouse(search);
  }

  /**
   * 设定仓库分页
   */
  @Override
  public Page<OrderRuleItemVo> warehousePage(OrderRuleSearchParamPo search) {
    Page<OrderRuleItemVo> warehousePage = new Page<>();
    if (
      Objects.nonNull(search.getWfStatus()) &&
      StringUtils.hasText(search.getFormName())
    ) {
      List<WorkFlow> workFlowList = workFlowService.queryWfListByStatus(
        search.getWfStatus(),
        search.getFormName()
      );
      if (CollectionUtils.isEmpty(workFlowList)) {
        return warehousePage;
      }
      List<Long> ids = workFlowList
        .stream()
        .map(WorkFlow::getRecordId)
        .collect(Collectors.toList());
      if (CollectionUtils.isEmpty(ids)) {
        return warehousePage;
      }
      search.setSelectedIds(ids);
    }
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    warehousePage = this.baseMapper.warehousePage(search.toPage(), search);
    List<Long> recordIds = warehousePage
      .getRecords()
      .stream()
      .map(OrderRuleItemVo::getId)
      .collect(Collectors.toList());
    if (CollectionUtils.isEmpty(recordIds)) {
      return warehousePage;
    }
    List<WorkFlow> workFlows = workFlowService.queryWfList(
      recordIds,
      Collections.singletonList(search.getFormName())
    );
    if (CollectionUtils.isEmpty(workFlows)) {
      return warehousePage;
    }
    Map<Long, Integer> flowMap = workFlows
      .stream()
      .collect(Collectors.toMap(WorkFlow::getRecordId, WorkFlow::getWfStatus));
    warehousePage
      .getRecords()
      .stream()
      .forEach(item -> {
        if (!flowMap.containsKey(item.getId())) {
          return;
        }
        item.setWfStatus(flowMap.get(item.getId()));
      });

    return warehousePage;
  }

  /**
   * 查询设定仓库最后更新时间
   * @param search 查询条件
   * @return 设定仓库最后更新时间
   */
  @Override
  public Date warehouseLastUpdateTime(OrderRuleSearchParamPo search) {
    return this.baseMapper.warehouseLastUpdateTime(search);
  }

  /**
   * 设定物流
   */
  @Override
  public List<OrderRuleItemVo> logistics(OrderRuleSearchParamPo search) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.logistics(search);
  }

  /**
   * 设定物流分页
   */
  @Override
  public Page<OrderRuleItemVo> logisticsPage(OrderRuleSearchParamPo search) {
    Page<OrderRuleItemVo> logisticsPage = new Page<>();
    if (
      Objects.nonNull(search.getWfStatus()) &&
      StringUtils.hasText(search.getFormName())
    ) {
      List<WorkFlow> workFlowList = workFlowService.queryWfListByStatus(
        search.getWfStatus(),
        search.getFormName()
      );
      if (CollectionUtils.isEmpty(workFlowList)) {
        return logisticsPage;
      }
      List<Long> ids = workFlowList
        .stream()
        .map(WorkFlow::getRecordId)
        .collect(Collectors.toList());
      if (CollectionUtils.isEmpty(ids)) {
        return logisticsPage;
      }
      search.setSelectedIds(ids);
    }
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    logisticsPage = this.baseMapper.logisticsPage(search.toPage(), search);
    List<Long> recordIds = logisticsPage
      .getRecords()
      .stream()
      .map(OrderRuleItemVo::getId)
      .collect(Collectors.toList());
    if (CollectionUtils.isEmpty(recordIds)) {
      return logisticsPage;
    }
    List<WorkFlow> workFlows = workFlowService.queryWfList(
      recordIds,
      Collections.singletonList(search.getFormName())
    );
    if (CollectionUtils.isEmpty(workFlows)) {
      return logisticsPage;
    }
    Map<Long, Integer> flowMap = workFlows
      .stream()
      .collect(Collectors.toMap(WorkFlow::getRecordId, WorkFlow::getWfStatus));
    logisticsPage
      .getRecords()
      .stream()
      .forEach(item -> {
        if (!flowMap.containsKey(item.getId())) {
          return;
        }
        item.setWfStatus(flowMap.get(item.getId()));
      });

    return logisticsPage;
  }

  /**
   * 查询设定物流最后更新时间
   * @param search 查询条件
   * @return 设定物流最后更新时间
   */
  @Override
  public Date logisticsLastUpdateTime(OrderRuleSearchParamPo search) {
    return this.baseMapper.logisticsLastUpdateTime(search);
  }

  /**
   * 配置地址
   */
  @Override
  public List<OrderRuleItemVo> address(OrderRuleSearchParamPo search) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.address(search);
  }

  /**
   * 配置地址分页
   */
  @Override
  public Page<OrderRuleItemVo> addressPage(OrderRuleSearchParamPo search) {
    Page<OrderRuleItemVo> addressPage = new Page<>();
    if (
      Objects.nonNull(search.getWfStatus()) &&
      StringUtils.hasText(search.getFormName())
    ) {
      List<WorkFlow> workFlowList = workFlowService.queryWfListByStatus(
        search.getWfStatus(),
        search.getFormName()
      );
      if (CollectionUtils.isEmpty(workFlowList)) {
        return addressPage;
      }
      List<Long> ids = workFlowList
        .stream()
        .map(WorkFlow::getRecordId)
        .collect(Collectors.toList());
      if (CollectionUtils.isEmpty(ids)) {
        return addressPage;
      }
      search.setSelectedIds(ids);
    }
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    addressPage = this.baseMapper.addressPage(search.toPage(), search);
    List<Long> recordIds = addressPage
      .getRecords()
      .stream()
      .map(OrderRuleItemVo::getId)
      .collect(Collectors.toList());
    if (CollectionUtils.isEmpty(recordIds)) {
      return addressPage;
    }
    List<WorkFlow> workFlows = workFlowService.queryWfList(
      recordIds,
      Collections.singletonList(search.getFormName())
    );
    if (CollectionUtils.isEmpty(workFlows)) {
      return addressPage;
    }
    Map<Long, Integer> flowMap = workFlows
      .stream()
      .collect(Collectors.toMap(WorkFlow::getRecordId, WorkFlow::getWfStatus));
    addressPage
      .getRecords()
      .stream()
      .forEach(item -> {
        if (!flowMap.containsKey(item.getId())) {
          return;
        }
        item.setWfStatus(flowMap.get(item.getId()));
      });

    return addressPage;
  }

  /**
   * 查询配置地址最后更新时间
   * @param search 查询条件
   * @return 配置地址最后更新时间
   */
  @Override
  public Date addressLastUpdateTime(OrderRuleSearchParamPo search) {
    return this.baseMapper.addressLastUpdateTime(search);
  }

  /**
   * 订单审核
   */
  @Override
  public List<OrderRuleItemVo> process(OrderRuleSearchParamPo search) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.process(search);
  }

  /**
   * 订单审核分页
   */
  @Override
  public Page<OrderRuleItemVo> processPage(OrderRuleSearchParamPo search) {
    Page<OrderRuleItemVo> processPage = new Page<>();
    if (
      Objects.nonNull(search.getWfStatus()) &&
      StringUtils.hasText(search.getFormName())
    ) {
      List<WorkFlow> workFlowList = workFlowService.queryWfListByStatus(
        search.getWfStatus(),
        search.getFormName()
      );
      if (CollectionUtils.isEmpty(workFlowList)) {
        return processPage;
      }
      List<Long> ids = workFlowList
        .stream()
        .map(WorkFlow::getRecordId)
        .collect(Collectors.toList());
      if (CollectionUtils.isEmpty(ids)) {
        return processPage;
      }
      search.setSelectedIds(ids);
    }
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    processPage = this.baseMapper.processPage(search.toPage(), search);
    List<Long> recordIds = processPage
      .getRecords()
      .stream()
      .map(OrderRuleItemVo::getId)
      .collect(Collectors.toList());
    if (CollectionUtils.isEmpty(recordIds)) {
      return processPage;
    }
    List<WorkFlow> workFlows = workFlowService.queryWfList(
      recordIds,
      Collections.singletonList(search.getFormName())
    );
    if (CollectionUtils.isEmpty(workFlows)) {
      return processPage;
    }
    Map<Long, Integer> flowMap = workFlows
      .stream()
      .collect(Collectors.toMap(WorkFlow::getRecordId, WorkFlow::getWfStatus));
    processPage
      .getRecords()
      .stream()
      .forEach(item -> {
        if (!flowMap.containsKey(item.getId())) {
          return;
        }
        item.setWfStatus(flowMap.get(item.getId()));
      });

    return processPage;
  }

  /**
   * 查询订单审核最后更新时间
   * @param search 查询条件
   * @return 订单审核最后更新时间
   */
  @Override
  public Date processLastUpdateTime(OrderRuleSearchParamPo search) {
    return this.baseMapper.processLastUpdateTime(search);
  }

  /**
   * 订单标发
   */
  @Override
  public List<OrderRuleItemVo> issu(OrderRuleSearchParamPo search) {
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    return this.baseMapper.issu(search);
  }

  /**
   * 订单标发分页
   */
  @Override
  public Page<OrderRuleItemVo> issuPage(OrderRuleSearchParamPo search) {
    Page<OrderRuleItemVo> issuPage = new Page<>();
    if (
      Objects.nonNull(search.getWfStatus()) &&
      StringUtils.hasText(search.getFormName())
    ) {
      List<WorkFlow> workFlowList = workFlowService.queryWfListByStatus(
        search.getWfStatus(),
        search.getFormName()
      );
      if (CollectionUtils.isEmpty(workFlowList)) {
        return issuPage;
      }
      List<Long> ids = workFlowList
        .stream()
        .map(WorkFlow::getRecordId)
        .collect(Collectors.toList());
      if (CollectionUtils.isEmpty(ids)) {
        return issuPage;
      }
      search.setSelectedIds(ids);
    }
    search.initSort("t.id desc", "t.", SORT_FIELD_MAP);
    issuPage = this.baseMapper.issuPage(search.toPage(), search);
    List<Long> recordIds = issuPage
      .getRecords()
      .stream()
      .map(OrderRuleItemVo::getId)
      .collect(Collectors.toList());
    if (CollectionUtils.isEmpty(recordIds)) {
      return issuPage;
    }
    List<WorkFlow> workFlows = workFlowService.queryWfList(
      recordIds,
      Collections.singletonList(search.getFormName())
    );
    if (CollectionUtils.isEmpty(workFlows)) {
      return issuPage;
    }
    Map<Long, Integer> flowMap = workFlows
      .stream()
      .collect(Collectors.toMap(WorkFlow::getRecordId, WorkFlow::getWfStatus));
    issuPage
      .getRecords()
      .stream()
      .forEach(item -> {
        if (!flowMap.containsKey(item.getId())) {
          return;
        }
        item.setWfStatus(flowMap.get(item.getId()));
      });

    return issuPage;
  }

  /**
   * 查询订单标发最后更新时间
   * @param search 查询条件
   * @return 订单标发最后更新时间
   */
  @Override
  public Date issuLastUpdateTime(OrderRuleSearchParamPo search) {
    return this.baseMapper.issuLastUpdateTime(search);
  }
}
